IT 244: Introduction to Linux/Unix
Answers to Mid-term Exam - Odd Columns

  1. What do you call a text file containing Unix commands that are run just before the shell gives you a prompt?
    a startup file
  2. By default, which account is the owner of a file or directory?
    the account that created it
  3. Name the three types of access permissions.
    read, write and execute
  4. Name the three categories of accounts which are used in assigning access permissions.
    owner, group, everyone else
  5. What is the name of the account that can do ANYTHING on a Unix or Linux system?
    root
  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. If you have write permission on a directory do you have write permission on the files it contains?
    no, you need write permission on each file
  8. What does the PATH shell variable contain?
    the list of directories the shell must search to find the file to run a command
  9. Does the shell check that a program gets the arguments or options it needs?
    no, that is the responsibility of the program itself
  10. By default, where does Standard Input come from?
    the keyboard
  11. What is a process?
    a running program
  12. What does a program do JUST BEFORE it stops running?
    it sends an exit status to the shell
  13. What does an exit status of 0 mean?
    it means that the program encountered no errors
  14. By default, where does Standard Output go?
    to the screen
  15. By default, where does Standard Error go?
    to the screen
  16. 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
  17. Look at the diagram on the last page.
    You are in the directory named courses.
    Write the RELATIVE pathname for the directory named hw2 under the it117 directory.
    You do not have to write a Unix command, I only want the pathname.
    it/it117/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. Look at the diagram on the last page.
    You are in the directory named it.
    Write the RELATIVE pathname for the django directory.
    You do not have to write a Unix command, I only want the pathname.
    ../../projects/django
  20. 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
  21. Write a command line that will show every line in the file memo.txt that contains the word "hope" but NOT the word "bad".
    grep hope memo.txt | grep -v bad
  22. What is the name of the only program that can create a process?
    the kernel
  23. Write a single command to copy the file memo.txt from your home directory to your current directory.
    cp  ~/memo.txt  .
  24. Write a command that will change the permissions on the FILE named work 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.
    You MUST use numeric arguments.
    chmod  754  work
  25. Write a command that will change the permission on the DIRECTORY named dir1 so that the owner can see what is in the directory and create files there, the group can see the contents of the directory and everyone else can only cd into the directory. You MUST use numeric arguments.
    chmod  641  dir1