Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

8:59 v Done relativevsabsolutelab.docx Relative versus Absolute Lab Assuming tha

ID: 3751532 • Letter: 8

Question

8:59 v Done relativevsabsolutelab.docx Relative versus Absolute Lab Assuming that you have a directory structure like the image below, answer the questions below. ept test.ah cleansh file fils filet file2 ile old 1. If your current working directory is /home/sue, what is the scripts directory and its contents using a relative path only? 2. Repeat the command above, but redirect the output to a file command that will display how much space is taken up by the named file9 in your home directory. 3. If your current working directory is /home/sue what is the command to display any of the last 8 lines of file5 that contain the text error using a relative path only? 4. If your current working directory is /home/tom/scripts what is the command to display all of the lines of the file clean.sh that contain the text "Port" on the screen using relative paths only? tesLsh clean.sh 10 file1 file2 1) old file2 eS file

Explanation / Answer

1. du -sh ../tom/scripts
du is used to display the amount of space taken up by a directory.
2. du -sh ../tom/scripts > ./file9
The > symbol is used to redirect the output to the specified file.
3. grep "error" ../tom/docs/old/file5 | tail -n8
grep is used to search for a regular expression and the tail-nx command is used to display the last x lines of the file.
4. grep "Port" ./clean.sh
./ is used to access a file or directory present in the current working directory.
5. cat ./old/file5 > ./file4
cat is used to display the contents of a file.
6. who | sort > ./dir1/file4
The who command is used to display the list of currently logged in users and the sort command without any options is used to sort on the first column of a file.
7. sort ./sue/dir1/file4 >> ./tom/docs/file3 | cat file3
The | (pipe) symbol is used to pass the output of one command as input to another command.
8. sort -n ../tom/docs/old/file5 | uniq
uniq is used to display only unique lines in a file.
9. cat ../../../sue/dir1/file9 | tee -a ../file3 | more
the tee command is used to take the outout of one command and process it while further passing the received output to another command.
10. sort ../../../sue/dir1/file9 > ../../../../mail/mail1
11. grep "test$" ./sue/myfile
The $ at the end of an regular expression indicates that the expression should be at the end of the line.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at drjack9650@gmail.com
Chat Now And Get Quote