Chapter 7: Managing Files (Review Questions)

¡Supera tus tareas y exámenes ahora con Quizwiz!

-u or --update

You want to copy a file (origfile.txt) to the backups directory, but if a file called origfile.txt exists in the backups directory, you want to go ahead with the copy only if the file in the source location is newer than the one in backups. The command to do this is cp ____ origfile.txt backups/.

rm -R junk, rm -r junk, or rm --recursive junk

You've typed rmdir junk to delete the junk directory, but this command has failed because junk contains word processing files. What command might you type to do the job?

True. Symbolic links work by storing the name of the linked-to file in the symbolic link file. Linux reads this filename and transparently substitutes the linked-to file. This process works both on a single filesystem and across filesystems, so the statement is true. Hard links, by contrast, work by providing multiple directory entries that point to a single file. This method of creating a link does not work across low-level filesystems.

True or false: You can create a symbolic link from one low-level filesystem to another.

False. Linux's security features prevent accidental damage when you work as an ordinary user. You must be more careful when you acquire root privileges to perform system maintenance, though.

True or false: You can easily damage your Linux installation by mistyping an rm command when you log into your regular account.

True. The touch command updates a file's time stamps, and for this purpose, a directory counts as a file, so this statement is true.

True or false: You can set a directory's time stamps with the touch command.

/etc

What directory primarily contains system configuration files?

A. The mv command moves or renames a file, so option A is correct. The cp command copies a file, so option B is incorrect. The ln command creates a link between two files, so option C is incorrect. Option D's rn command is fictitious, so this option is incorrect. The touch command creates a new file or adjusts the time stamps on an existing file, so option E is incorrect.

Which of the following commands would you type to rename newfile.txt to afile.txt? A) mv newfile.txt afile.txt B) cp newfile.txt afile.txt C) ln newfile.txt afile.txt D) rn newfile.txt afile.txt E) touch newfile.txt afile.txt

?

Which wildcard character matches any one symbol in a filename?

A, B. If you try to create a directory inside a directory that doesn't exist, mkdir responds with a No such file or directory error. The -parents parameter tells mkdir to create all necessary parent directories automatically in such situations, so option A is correct. You can also manually do this by creating each necessary directory separately, so option B is also correct. (It's possible that mkdir one wouldn't be necessary in this example if the directory one already existed. No harm will come from trying to create a directory that already exists, although mkdir will return a File exists error.) Option C will have no useful effect; at most, it will change the time stamps on the mkdir program file, but if you type it as a normal user, it probably won't even do that. Options D and E are both based on the premise that you must remove directories that already exist with the names that you want to use, but this isn't true, so these options are both incorrect.

You type mkdir one/two/three and receive an error message that reads, in part, No such file or directory. What can you do to overcome this problem? (Select all that apply.) A) Add the --parents parameter to the mkdir command. B) Issue three separate mkdir commands: mkdir one, then mkdir one/two, and then mkdir one/two/three. C) Type touch /bin/mkdir to be sure that the mkdir program file exists. D) Type rmdir one to clear away the interfering base of the desired new directory tree. E) Type rm -r one to clear away the entire interfering directory tree.

C. Because two files (outline.pdf and Outline.PDF) have names that differ only in case, and because FAT is a case-insensitive filesystem, one of those files will be missing on the copy. (Both files will be copied, but the second one copied will overwrite the first.) Thus option C is correct. The specified cp command does not create links, so option A is incorrect. Because the specified cp command included the -a option, which performs a recursive copy, all of the files in MyFiles will be copied, along with the directory itself, so option B is incorrect. In order to copy all of the files, you will have to change one file's name manually; however, cp won't do this automatically, so option D is incorrect. Because option C is correct, option E is not correct.

You want to copy a directory, MyFiles, to a USB flash drive that uses the FAT filesystem. The contents of MyFiles are as follows: $ ls -l MyFiles/total 276-rw-r-r- 1 jen users 129840 Nov 8 15:13 contract.odt-rw-r-r- 1 rod users 42667 Nov 8 15:12 outline.pdf-rw-r-r- 1 sam users 105979 Nov 8 15:12 Outline.PDF The USB flash drive is mounted at /media/usb, and so you type cp -a MyFiles/ /media/usb. What problem will occur when you attempt to copy these files? A) The command will fail because it tries to create links. B) The MyFiles directory will be copied, but none of its files will be copied. C) One file will be missing on the USB flash drive. D) One file's name will be changed during the copy. E) Everything will be fine; the command will work correctly.


Conjuntos de estudio relacionados

WGU Principles of Psychology, D167

View Set

Pathophysiology chapter 17 Control of Cardiovasvular Function

View Set

Chapter 3: Solving Problems by Searching

View Set

GCSE Computer Science: Unit 2.3 Robust Programs L1

View Set

Module 11: Wireless Network Security

View Set