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


  1. 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
  2. Write a command to sort the file memo.txt and print only the first 10 lines.
    sort memo.txt | head
  3. By default, where does Standard Output go?
    to the screen
  4. What does the PATH shell variable contain?
    the list of directories the shell must search 
    to find the file to run a command
  5. 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
  6. 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/*
  7. 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  &
  8. What is special about a GLOBAL variable?
    you can use it in any subshell of the shell in which it was created.
  9. 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
  10. When does a while loop stop running?
    when the command following while returns an exit status that is not 0
  11. What does the break command in a loop do?
    jumps completely out of the loop
  12. 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
  13. What is the name of the library of procedures that allows you to edit the command line?
    the Readline library
  14. 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
  15. What command would you use to see all currently running jobs?
    jobs
  16. What is a built-in?
    a command whose code is part of the shell and does not exist as an executable file on disc
  17. 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
  18. Can an alias be made global?
    no
  19. 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 ]
  20. Name the three types of access permissions.
    read, write and execute
  21. Name the three things that can be completed at the command line by hitting Tab.
    pathnames, commands, shell variables
  22. By default, where does Standard Input come from?
    the keyboard
  23. 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
  24. What is a process?
    a running program
  25. By default, which account is the owner of a file or directory?
    the account that created it
  26. What parameter gives the total number of arguments passed to a script from the command line?
    #
  27. 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.
    ../../..
  28. What is the value of the exit status returned by test to indicate that the expression is true?
    0
  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. What does a program do just before it stops running?
    it sends an exit status to the shell
  31. If a command is running in the background, can it take input from the keyboard?
    no
  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 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
  33. 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