IT 244: Introduction to Linux/Unix
Answers Final Exam Questions - Odd Columns


  1. By default, which account is the owner of a file or directory?
    the account that created it
  2. Name the three types of access permissions.
    read, write and execute
  3. Name the three categories of accounts which are used in assigning access permissions.
    owner, group, everyone else
  4. What is a process?
    a running program
  5. What does a program do just before it stops running?
    it sends an exit status to the shell
  6. What does an exit status of 0 mean?
    it means that the program encountered no errors
  7. By default, where does Standard Input come from?
    the keyboard
  8. By default, where does Standard Output go?
    to the screen
  9. By default, where does Standard Error go?
    to the screen
  10. What does the PATH shell variable contain?
    the list of directories the shell must search 
    to find the file to run a command
  11. If you have a copy of the executable script bother.sh in your current directory, what would you type at the command line to run this script in the background?
    ./bother.sh  &
  12. If a command is running in the background, can it take input from the keyboard?
    no
  13. If you wanted to run the executable file backup.sh in your current directory, but wanted the error messages to disappear, what would you write at the command line?
    ./backup.sh  2>  /dev/null
  14. What would you write on the command line to create the GLOBAL variable named school and set its value to UMass Boston.
    export school="UMass Boston"
  15. What parameter gives the total number of arguments passed to a script from the command line?
    #
  16. If you wanted to use the value of the variable team inside quotes, what kind of quotes would you use?
    double quotes, ""
  17. Name the three things that can be completed at the command line by hitting Tab.
    pathnames, commands, shell variables
  18. What would you write at the command line to define the alias ll whose value was ls -l ?
    alias ll='ls -l'
  19. Does the command that follows if need to be test?
    no, it can be any command that returns an exit status
  20. What do [ and ] mean when used in an if statement?
    they stand for the test command
  21. Look at the diagram at the back of this exam.
    Assume that you are in the directory ghoffman.
    Write the ABSOLUTE pathname you would use to reference the directory proj1 inside the directory jimbo.
    I do not want a command, just the pathname.
    /home/jimbo/proj1
  22. Look at the diagram at the back of this exam.
    Assume that you are in the directory it116 under the directory work under the directory home.
    Write the RELATIVE pathname you would use to reference the directory home.
    I do not want a command, just the pathname.
    ../../home
  23. Look at the diagram at the back of this exam.
    Assume that you are in the directory proj1 inside jimbo.
    Write the RELATIVE pathname you would use to reference the root directory.
    I do not want a command, just the pathname.
    ../../..
  24. Look at the diagram at the back of this exam.
    Assume that you are in the directory home.
    Write the RELATIVE pathname you would use to reference the directory it116 under the directory work.
    I do not want a command, just the pathname.
    ghoffman/work/it116
  25. Assume that you are in a directory that contains the files listed at the bottom of the diagram at the back of this exam.
    What ARGUMENT USING META-CHARACTERS would you give to ls to list all files with an .sh extension in this directory?
    I do not want the full command, just the argument to that command.
    *.sh
  26. Assume that you are in a directory that contains the files listed at the bottom of the diagram at the back of this exam.
    What ARGUMENT USING META-CHARACTERS would you give to ls to list all files whose name starts with "foo" followed by one character in this directory?
    I do not want the full command, just the argument to that command.
    foo?.txt
  27. Assume that you are in a directory that contains the files listed at the bottom of the diagram at the back of this exam.
    What ARGUMENT USING META-CHARACTERS would you give to ls to list the "bar" files 2 to 7 in this directory?
    I do not want the full command, just the argument to that command.
    bar[2-7].txt
  28. Write the format string you would give to chmod to give a FILE the following permissions.
    Give the owner read, write permissions.
    Give the group read permissions.
    Give no permissions to anyone else.
    I just want the format string NOT the whole command.
    640
  29. Write the format string you would give to chmod to give a DIRECTORY the following permissions.
    Give the owner all permissions.
    Give the group permission to see the contents of the directory.
    Give everyone else the permissions to cd into that directory .
    741
  30. Write the SINGLE the command you would use to change the name of the file foo.txt to bar.txt.
    mv foo.txt bar.txt
  31. If you ran the script bother.sh as shown below, what command would you use to stop this script?
    $ ./bother.sh &
    [1] 26422
    kill 26422 or kill %1
  32. Write the command you would use to test whether the value of the variable number was equal to 0.
    test $number -eq 0 or [ $number -eq 0 ]
  33. Write the command you would use to find all the lines in the file output.txt which contain the word "grape" but NOT the word "red".
    grep  grape output.txt | grep -v red