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

Given the following directory structure, answer questions 15-20 bin ete home us

ID: 3726356 • Letter: G

Question

Given the following directory structure, answer questions 15-20 bin ete home us temp temp2 15. If you are currently in the direetory marst, write a relative path to dukeg. 16. If you are currently in the directory b, write an absolute path to etc. 17. If you are currently in the directory a, where does .J.d. take you? Assume for questions 18-21 that you have proper permission to accomplish the tasks. 18. Write a command to rename the file in /home/foxr called foo.txt to for.txt. 19. Write a command to move all files in /home/foxr/temp to /home/foxr/temp2/a. 20. Write a command to copy everything underneath foxr's temp2 directory including its subdirectories and their contents to dukeg's home directory.

Explanation / Answer

15) ../dukeg

with ../ you climb backwards out of the present working directory. then writing the name of the directory you want to access from there will make it your present working directory.

16) ../../../../etc

writing ../ 4 times will take you 4 steps higher in the directory hierarchy to root. From there you can go one step downward to etc, which is located inside the root. (see the file tree)

17) home

writing cd ../../.. means we are going back 3 steps up in the directory hierarchy. And 3 steps upwards of directory a is home. (see the file tree)

18) mv /home/foxr/foo.txt /home/foxr/for.txt

We use mv (move) command to rename files in linux. following mv we write the paths of the file we want to rename and path of the file we want to rename it to seperated by a space.

19) mv /home/foxr/temp/* /home/foxr/temp2/a

We again use the mv (move) command as it will move the files in one directory to other directory. We write the path of the source directory followed by (*). This star indicates that we want to move all the files. Then we write the path to the destination directory.

20) cp -r /home/foxr/temp2/ /home/dukeg

For we use the cp (copy) command. we use the option -r (recursive) to copy all the subdirectories and their contents as well. We have to write the path to the source directory first then then path to the destination directory seperated by a space.

Please rate this answer as a thumbs up if this solved your doubt. If you encounter any problem regarding this solution please post a comment, I will be happy to help you.

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