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. What does the PATH shell variable contain?
    the list of directories the shell must search 
    to find the file to run a command
  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. By default, where does Standard Input come from?
    the keyboard
  7. By default, where does Standard Output go?
    to the screen
  8. 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  &
  9. If a command is running in the background, can it take input from the keyboard?
    no
  10. What command would you use to see all currently running jobs?
    jobs
  11. What is a built-in?
    a command whose code is part of the shell and does not exist as an executable file on disc
  12. What is special about a GLOBAL variable?
    you can use it in any subshell of the shell in which it was created.
  13. What parameter gives the total number of arguments passed to a script from the command line?
    #
  14. What is the name of the library of procedures that allows you to edit the command line?
    the Readline library
  15. Name the three things that can be completed at the command line by hitting Tab.
    pathnames, commands, shell variables
  16. Write the command you would use to create the files foo1.txt to foo5.txt using brace expansion and the touch command.
    touch  foo{1,2,3,4,5}.txt
  17. Can an alias be made global?
    no
  18. What is the value of the exit status returned by test to indicate that the expression is true?
    0
  19. When does a while loop stop running?
    when the command following while returns an exit status that is not 0
  20. What does the break command in a loop do?
    jumps completely out of the loop
  21. Look at the diagram at the back of this exam.
    Assume that you are in the directory jimbo.
    Write the ABSOLUTE pathname you would use to reference the directory tmp inside the directory ghoffman.
    I do not want a command, just the pathname.
    /home/ghoffman/tmp
  22. 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 it244 under the directory courses.
    I do not want a command, just the pathname.
    ../courses/it244
  23. Look at the diagram at the back of this exam.
    Assume that you are in the directory s22 inside it117.
    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 a .txt extension in this directory?
    I do not want the full command, just the argument to that command.
    *.txt
  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 "bar" followed by one character and ".txt" in this directory?
    I do not want the full command, just the argument to that command.
    bar?.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 files whose name starts with "foo" followed by the digits 2 through 5, followed by ".txt"?
    I do not want the full command, just the argument to that command.
    foo[2-5].txt
  28. Write the format string you would give to chmod to give a FILE the following permissions.
    Give the owner read, write and execute permissions.
    Give the group read and execute permissions.
    Give read permissions to anyone else.
    I just want the format string NOT the whole command.
    754
  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 and change the contents of the directory.
    Give everyone else the permissions to cd into that directory .
    761
  30. 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 ]
  31. Write a command to sort the file memo.txt and print only the first 10 lines.
    sort memo.txt | head
  32. Write a command that will find all the lines containing "hard" in the file memo.txt but NOT the word "red".
    grep hard memo.txt | grep -v red
  33. Let's say your there is a directory named work in your current directory. Write a command to remove all the files in the work directory.
    rm work/*