Name:

Using your browser, save a copy of http://andersje.github.io/corporate-linux-admin/labs/lab2.datafile into your /tmp directory. Using that datafile, you can complete all questions on this worksheet. Write the correct answer after each question.

  1. using grep, pick out all the lines containing 134.29 from the sample file:


  2. Invert the answer to the above question. That is, pick out all the lines which do NOT contain 134.29

  3. Now display all lines which contain the word server:

  4. Now display all lines which contain the word work:

  5. Now display all lines which contain the word workstation:

  6. If the answers to #4 and #5 did not produce the same result, explain why:


  7. Using a pipe, alter the answer to #5 such that it is sorted by the first column

  8. Using a pipe, alter the answer to #5 such that it is reverse sorted numerically (that is, 5 would come before 4) by the third column

  9. remove all duplicate entries from the answer to the previous question:

  10. Use awk to display the first two columns of data from the datafile:

  11. Modify the answer to the previous question such that it is sort by the first column:

  12. Modify the answer to the previous question such that all duplicates are removed, and results are stored in a file named "number12.txt":

  13. Now, use the wc command to determine how many lines of data are produced:

  14. Now, use the wc command to print ONLY the number of lines of data are produced:

  15. How many lines of data were produced?
  16. Show the command to find all files on the system which are sockets (type s):

  17. Show the command to find all files on the system owned by user jeremy:

  18. Alter the above question so that all error messages are discarded:

  19. Alter the answer from the previous question so that the results are redirected into the file /tmp/jeremy.out:

  20. Alter the answer from the previous question so that all error messages are redirected into the file /tmp/jeremy.err:

  21. Extra Credit

  22. Show the single command that will remove all 'other' permissions from all files and directories under /home, and won't affect ANY user or group permissions:

  23. (3 points) A coworker comes to you, and shows you this command:
    grep apsrp hostlist.txt | sort -u | grep -v 2235 hostlist.txt
    They complain that the output contains many things which do not contain "apsrp". Why is that?