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

View the contents of this file and the passwd file in the /etc directory to make

ID: 3746593 • Letter: V

Question

View the contents of this file and the passwd file in the /etc directory to make sure it is the same file. 30.) What commands did you enter to view both files?

To delete a file, type rm filename, where filename is the name of the file. Delete the accounts file. 31.) Did you receive a message? To always be prompted when deleting files, you can use rm –i filename , and to avoid any potential message, you can type rm –f filename.

This file is Foo.txt

Let’s get the file back. Type a cp command to copy the passwd file from the /etc directory to your current location. To indicate your current location, use a “.” as in cp path_to_filename . where path_to_filename is the path to the file. You should still be in the temp directory. 32.) What command did you enter?

Move up one level in the file space. Let’s try to delete the temp directory. Type rmdir temp. What happened? Why? To delete a non-empty directory, first delete the files from within it. Or, use the rm command with the option –r, changing the delete into a “recursive delete”. Type rm –r temp and see what happens. 33.) What do you think “recursive delete” means? You might choose to research this question. At this point, you can close your terminal window and shut down your Linux VM.

Explanation / Answer

For the first part, you can directly view the files by using any of the following commands:

Inside the/etc directory.

These may require sudo permissions, if you have the access you definitely view the contents of the file.

For the copying passwd file to /temp file the following command needs to be used:

(Assuming you are in the /temp location) -> sudo cp /etc/<filename> .

To move up one level type: cd ..

rmdir temp -> This won't be successful, as temp is a non-empty folder, you need to recursively delete the file structure.

What do you think “recursive delete” means? -> Thus, in short, refers to deleting each and every file within the specified folder, level by level until none is left.