IT 244: Introduction to Linux/Unix
Quiz 2 Answers

  1. What would you type at the command line if you wanted to see the value of the variable SHELL?
    echo  $SHELL
  2. If you started typing the name of a file on the command line and wanted Unix to supply the rest, what would you do?
    hit the Tab key
  3. What would you type at the command line if you wanted to find all lines in the file results.txt that contained the word "homework"?
    grep  homework  results.txt
  4. What would you type at the command line if you wanted to find all lines in the file results.txt that DID NOT contain the word "homework"?
    grep -v homework  results.txt
  5. What would you type at the command line if you wanted to see all the lines in numbers.txt sorted in REVERSE NUMERIC order?
    sort -nr numbers.txt
  6. If you saw the following prompt, what is your CURRENT DIRECTORY?
    it244gh@vm75:/courses/it244/s19/ghoffman$
    /courses/it244/s19/ghoffman
  7. What would you type at the command line if your wanted to find all lines in the file red_sox.txt that had the word "Win", but NOT the word "Rays"?
    grep  Win  red_sox.txt  |  grep -v Rays
  8. What would you type at the command line if your wanted to find all lines in the file red_sox.txt that had the word "Win", but NOT the word "Rays", and have the lines sorted alphabetically?
    grep  Win  red_sox.txt  |  grep -v Rays  |  sort
  9. What program would you use to find where the program file for tar is located?
    which or whereis
  10. What command would you use to find out all the users currently logged on to the machine you are using?
    finger or who