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


  1. 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 "bar" followed by the digits 3 through 7, followed by ".txt"?
    I do not want the full command, just the argument to that command.
    bar[3-7].txt
  2. Look at the diagram at the back of this exam.
    Assume that you are in the directory courses.
    Write the RELATIVE pathname you would use to reference the directory ghoffman under the directory home.
    I do not want a command, just the pathname.
    ../home/ghoffman
  3. 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
  4. By default, where does Standard Output go?
    to the screen
  5. 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 and ".txt" in this directory?
    I do not want the full command, just the argument to that command.
    foo?.txt
  6. 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 .sh extension in this directory?
    I do not want the full command, just the argument to that command.
    *.sh
  7. Look at the diagram at the back of this exam.
    Assume that you are in the directory courses.
    Write the RELATIVE pathname you would use to reference the directory mary under f21 under it117.
    I do not want a command, just the pathname.
    it117/f21/mary
  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 print ALL global variables and their values.
    env
  10. Look at the diagram at the back of this exam.
    Assume that you are in the directory it244.
    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
  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 are the limitations of a LOCAL variable?
    you can only use it in the shell in which it was created
  14. What do [ and ] mean when used in an if statement?
    they stand for the test command
  15. Look at the diagram at the back of this exam.
    Assume that you are in the directory tmp inside ghoffman.
    Write the RELATIVE pathname you would use to reference the root directory.
    I do not want a command, just the pathname.
    ../../..
  16. What does the PATH shell variable contain?
    the list of directories the shell must search 
    to find the file to run a command
  17. Can an alias be made global?
    no
  18. By default, where does Standard Input come from?
    the keyboard
  19. 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 no permissions for that directory .
    760
  20. What is the name of the process that starts automatically whenever pe15 is turned on?
    systemd
  21. Write the command that will find all the lines in the file memo.txt that contain the word "mountain" but not the word "range".
    grep mountain memo.txt | grep -v range
  22. When does a while loop stop running?
    when the command following while returns an exit status that is not 0
  23. By default, where does Standard Error go?
    to the screen
  24. What command would you use to see all currently running jobs?
    jobs
  25. Is there any limit to the number of blocks of commands you can have in an if ... else ... elif statement?
    no
  26. 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 permissions.
    Give read and execute permissions to anyone else.
    I just want the format string NOT the whole command.
    745
  27. What is the value of the exit status returned by test to indicate that the expression is true?
    0
  28. What parameter gives the total number of arguments passed to a script from the command line?
    #
  29. What would you type at the command line if you wanted to suspend a job running in the foreground?
    Control Z
  30. What does the break command in a loop do?
    jumps completely out of the loop
  31. Does the command that follows if need to be test?
    no, it can be any command that returns an exit status
  32. What parameter gives the full pathname of the script that is currently being run?
    0
  33. 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