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


  1. By default, where does Standard Output go?
    to the screen
  2. 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
  3. By default, which account is the owner of a file or directory?
    the account that created it
  4. What parameter gives the total number of arguments passed to a script from the command line?
    #
  5. 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 ]
  6. Does the command that follows if need to be test?
    no, it can be any command that returns an exit status
  7. Name the three categories of accounts which are used in assigning access permissions.
    owner, group, everyone else
  8. 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
  9. 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
  10. 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
  11. 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"
  12. 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.
    ../../..
  13. What do [ and ] mean when used in an if statement?
    they stand for the test command
  14. 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  &
  15. What would you write at the command line to define the alias ll whose value was ls -l ?
    alias ll='ls -l'
  16. Name the three things that can be completed at the command line by hitting Tab.
    pathnames, commands, shell variables
  17. What is a process?
    a running program
  18. What does the PATH shell variable contain?
    the list of directories the shell must search 
    to find the file to run a command
  19. What does a program do just before it stops running?
    it sends an exit status to the shell
  20. 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
  21. By default, where does Standard Error go?
    to the screen
  22. 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
  23. If a command is running in the background, can it take input from the keyboard?
    no
  24. 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
  25. Name the three types of access permissions.
    read, write and execute
  26. 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
  27. What does an exit status of 0 mean?
    it means that the program encountered no errors
  28. If you wanted to use the value of the variable team inside quotes, what kind of quotes would you use?
    double quotes, ""
  29. 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
  30. By default, where does Standard Input come from?
    the keyboard
  31. 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
  32. 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
  33. 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