Your present working directory is /var/www
Your home directory is /home/brian
1. sort the last five lines of file 8 and display it to the screen. Redirect all errors to /dev/null (use paths that are relative-to-home)
2. using the shortest paths possible display all lines that contain the text “username” of file10 and append them to file7
3. using relative paths only, count the lines of file14 that contain the text “trumpet”. Append the output to file6
4. using relative to home paths output the contents of file8 appended to a new file called file21 in your home directory
5. using the shortest path possible count the number of lines of text in file6 that contain the text “Subnet”. Redirect the output to file8
6. using the shortest paths possible create a file18 in Brian’s home directory that contains a directory listing of the docs2012 directory
7. find all of the files under /tmp that have names starting with “f”. append the output and all error messages to file4 (absolute paths)
8. send an email to steve@gmail.com Subject is “Quiz 4b” use the contents of file10 as the body message
9. what command would search the first 10 lines of all files in upload for the word “Author” (relative paths only)
10. copy file 6 to your home directory on the remote host zenith.senecac.on.ca Connect as the user brian
ANSWERS
1. tail –s ~/docs/file8 | sort 2> /dev/null
2. grep username ~lisa/documents/file10 | tee –a ./cgi_bin/file7
3. grep trumpet ../../shared/mkt/docs/file14 | wc –l >> ./cgi_bin/file6
OR
grep –c trumpet ../../shared/mkt/docs/file14 >> ./cgi_bin/file6
4. cat ~/docs/file8 >> ~/file21
5. grep “Subnet” cgi_bin/file6 | wc –l > ~/docs/file8
Don’t necessarily need the quotation marks
6. ls /shared/mkt/docs2012 > ~/file18
7. find /tmp –name f* >> /var/www/html/file4 2>&1
8. mail steve@gmail.com -s “Quiz 4b” < ~lisa/documents/file10
9. head ../ftp/upload/* | grep Author head -10 works as well
10. scp