IT 244: Introduction to Linux/Unix
Answers to Midterm Exam - Even Columns

  1. Write a command that will change the permissions on the file work.sh so that the owner can do anything with the file, the group can read and write it, and everyone else can only read the file.
    You MUST use the numeric format to specify the permissions.
    chmod  764  work.sh
  2. By default, where does Standard Output go?
    to the screen
  3. What does an exit status of 0 mean?
    it means that the program encountered no errors
  4. Name the three types of access permissions.
    read, write and execute
  5. What does the PATH shell variable contain?
    the list of directories the shell must search to find the file to run a command
  6. If you have read permission on a directory, what can you do in it?
    run ls on the directory to list its contents
  7. Look at the diagram on the last page.
    You are in the directory named gh under the home directory .
    Write the RELATIVE pathname for the directory named it117 under the courses directory.
    You do not have to write a Unix command, I only want the pathname.
    ../../courses/it
  8. Write a command that will change the permission on the directory dir1 so that the owner can do anything in the directory, the group can run ls and change the names of files in the directory, and everyone else can only run cd on the directory.
    You MUST use the numeric format to specify the permissions.
    chmod  761  dir1
  9. What is the name of the account that can do ANYTHING on a Unix or Linux system?
    root
  10. If you wanted to send the output of ls to the file dir_listing.txt, what would you enter at the command line?
    ls  >  dir_listing.txt
  11. Name the three categories of accounts which are used in assigning access permissions.
    owner, group, everyone else
  12. What does a program do JUST BEFORE it stops running?
    it sends an exit status to the shell
  13. Using REDIRECTION, create a duplicate of the file memo.txt in your current directory, called memo.bak, also in your current directory.
    DO NOT use the copy command.
    cat memo.txt > memo.bak
  14. Write a single command line entry that will find all lines in the file notes.txt that contain "goat" but not "shepard".
    grep goat notes.txt | grep -v shepard
  15. What is a process?
    a running program
  16. Look at the diagram on the last page.
    You are in the directory named courses.
    Write the RELATIVE pathname for the directory named hw1 under the it244 directory.
    You do not have to write a Unix command, I only want the pathname.
    it/it244/hw/hw1
  17. Look at the diagram on the last page.
    You are in the directory named django under projects.
    Write the ABSOLUTE pathname for the directory named hw under the it116 directory.
    You do not have to write a Unix command, I only want the pathname.
    /courses/it/it116/hw
  18. Look at the diagram on the last page.
    You are in the directory named hw under the it116 directory.
    Write the RELATIVE pathname for the root directory.
    You do not have to write a Unix command, I only want the pathname.
    ../../../..
  19. If you have read permission on a directory, can you read the files in that directory?
    no, you need read permission on each file
  20. By default, which account is the owner of a file or directory?
    the account that created it
  21. What do you call the directory directly above your current directory?
    the parent directory
  22. What is the name of the only program that can create a process?
    the kernel
  23. By default, where does Standard Input come from?
    the keyboard
  24. If you wanted to run the executable script work.sh in your current directory without using bash, what would you type at the command line?
    ./work.sh
  25. Write a single command to copy the file memo.txt from your parent directory to your current directory.
    cp  ../memo.txt  .