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

UNIX/Linux Unix/Linux Lab: Relative versus Absolute Assuming that you have a dir

ID: 3757350 • Letter: U

Question


UNIX/Linux
Unix/Linux Lab: Relative versus Absolute Assuming that you have a directory structure like the image below, answer the questions below 1. Display only line number 7 of clean.sh and also put the line in the new file named mail3 in the directory /mail Your current working directory is scripts Use relative paths only. 2. Display the number of words in the first 8 lines of file3 Your current working directory is /home/tom Use an absolute path only 3. If your current working directory is /home tom/decs what is the command to display the contents of the file file3 but redirect the output to a file in the same directory called file4? What is the command to delete the directory /home using absolute paths only. All errors should be appended to mail2 5. Write a single command that will count the number of users currently using the bash shell and put this information in a file called bash count in the lopt directory. Use absolute paths only. 6. What is the command to append a long directory listing of home/tom/docs to the file file5. Your current working directory is home/tom Use relative paths only 7. Display the last 10 lines of clean.sh Use relative paths only. Your current working directory is home/sue/dirl

Explanation / Answer

1. sed -n 7p clean.sh >> ../../../mail/mail3

2. head -n 8 /home/tom/docs/file3|wc -w

3. less file3 >> ../../sue/dir1/file4

4. rm -r /home/ >>/mail/mail2

5. who -u|wc -l >>/opt/bash_count

6. ls -lrt ./docs >> ./docs/old/file5

7. tail -n 10 ../../tom/scripts/clean.sh