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

  1. What directory is the starting point for a relative path?
    the current directory
  2. Look at the diagram on the last page.
    You are in the directory gh.
    Write the command to create a soft link to the hw2 directory under the it244 directory.
    You may use either an absolute or relative pathname.
    ln -s /courses/it/it244/hw/hw2
  3. What does an exit status of 0 mean?
    it means that the program encountered no errors
  4. Write a SINGLE command that will change the permissions on the FILE do_something so that the owner can do anything with the file, the group can read and execute it, and everyone else can only read the file.
    chmod  754  do_something
  5. How do you you abort a running program?
    Control C
  6. What directory is the starting point for EVERY absolute path?
    the root directory
  7. What would you type at the command line if you wanted to see the value of the variable SHELL?
    echo  $SHELL
  8. What would you write on the command line to remove the directory dir1 in your parent directory.
    Assume this directory is empty.
    rmdir ../dir1
  9. 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 it116 directory.
    You do not have to write a Unix command, I only want the pathname.
    it/it116/hw/hw1
  10. What command would you use to keep a record of every command you type and the output of those commands?
    script
  11. By default, which account is the owner of a file or directory?
    the account that created it
  12. Name the three types of access permissions.
    read, write and execute
  13. Write a SINGLE 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.
    chmod  761  dir1
  14. Look at the diagram on the last page.
    You are in the directory named bob under home.
    Write the RELATIVE pathname for the django directory under projects.
    You do not have to write a Unix command, I only want the pathname.
    ../../projects/django
  15. What does a program do just before it stops running?
    it sends an exit status to the shell
  16. What would you type at the command line if you wanted to see all the lines in numbers.txt sorted in REVERSE NUMERIC order?
    sort -nr numbers.txt
  17. Look at the diagram on the last page.
    You are in the directory named it.
    Write the ABSOLUTE pathname for the directory named hw2 under the it244 directory.
    You do not have to write a Unix command, I only want the pathname.
    /courses/it/it244/hw/hw2
  18. Look at the diagram on the last page.
    You are in the directory named it117.
    Write the RELATIVE pathname for the root directory.
    You do not have to write a Unix command, I only want the pathname.
    ../../..
  19. What would you type at the command line if you wanted to find all lines in the file results.txt that DID NOT contain the word "homework"?
    grep -v homework  results.txt
  20. What directory are you in when you first log in to a Unix machine?
    your own home directory
  21. Name the three categories of accounts which are used in assigning access permissions.
    owner, group, everyone else
  22. Write a SINGLE command to copy the file memo.txt from your parent directory to your current directory.
    cp  ../memo.txt  .
  23. What is the name of the only program that can create a process?
    the kernel
  24. What does the PATH shell variable contain?
    the list of directories the shell must search 
    to find the file to run a command
  25. Who can change the access permissions on a file or directory?
    only the owner