- Home
- Server Administration
- LPIC-1 Linux Administrator 101
61.
Why might you type touch filename?
- A.To move filename to the current directory
- B.To ensure that filename’s timestamp holds the current time
- C.To convert filename from DOS-style to Unix-style end-of-line characters
- D.To test the validity of filename’s disk structures
- E.To write cached data relating to filename to the disk
- Answer & Explanation
- Report
Answer : [B]
Explanation :
Explanation :
The touch utility updates a file’s time stamps, as option B specifies. (If the specified file doesn’t exist, touch creates an empty file.) You can’t move files with touch; that’s the job of the mv command, so option A is incorrect. Various tools can convert end-of-line formats, but touch is not one of them, so option C is incorrect. Testing the validity of disk structures, as in option D, is normally done on a whole-filesystem basis with fsck and related tools; touch can’t do this job. You can write cached data to disk for a whole filesystem by unmounting it or by using sync, but touch can’t do this, so option E is incorrect. |
62.
What parameter can you pass to ln to create a soft link? (Select two.)
- A.-s
- B.--soft
- C.--slink
- D.--symbolic
- E.--sl
- Answer & Explanation
- Report
Answer : [A,D]
Explanation :
Explanation :
The -s and --symbolic options to ln are equivalent, and both create a symbolic (aka soft) link. Thus, options A and D are both correct. Options B, C, and E are all fictitious. |
63.
You want to discover the sizes of several dot files in a directory. Which of the following
commands might you use to do this?
- A.ls -la
- B.ls -p
- C.ls -R
- D.ls –d
- E.ls -F
- Answer & Explanation
- Report
Answer : [A]
Explanation :
Explanation :
The -l parameter produces a long listing, including file sizes. The -a parameter produces a listing of all files in a directory, including the dot files. Combining the two produces the desired information (along with information about other files), so option A is correct. The -p, -R, -d, and -F options don’t have the specified effects, so the remaining options are all incorrect. |
64.
You want to move a file from your hard disk to a USB flash drive. Which of the following
is true?
- A.You’ll have to use the --preserve option to mv to keep ownership and permissions set correctly.
- B.The mv command will adjust filesystem pointers without physically rewriting data if the flash drive uses the same filesystem type as the hard disk partition.
- C.You must use the same filesystem type on both media to preserve ownership and permissions.
- D.The mv command will delete the file on the hard disk after copying it to the flash drive.
- E.You must use the FAT filesystem on the USB flash drive; Linux-native filesystems won’t work on removable disks.
- Answer & Explanation
- Report
Answer : [D]
Explanation :
Explanation :
When moving from one partition or disk to another, mv must necessarily read and copy the file and then delete the original if that copy was successful, as stated in option D. If both filesystems support ownership and permissions, they’ll be preserved; mv doesn’t need an explicit --preserve option to do this, and this preservation does not rely on having exactly the same filesystem types. Thus, option A is incorrect. Although mv doesn’t physically rewrite data when moving within a single low-level filesystem, this approach can’t work when you’re copying to a separate low-level filesystem (such as from a hard disk to a pen drive); if the data isn’t written to the new location, it won’t be accessible should the disk be inserted in another computer. Thus, option B is incorrect. Although not all filesystems support ownership and permissions, many do, and these attributes are preserved when moving files between them, so option C is incorrect. Although FAT is a common choice on removable media because of its excellent cross-platform support, other filesystems will work on such disks, so option E is incorrect. |
65.
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 two.)
- 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 the mkdir program file exists.
- D.Type rmdir one to clear away the interfering base of the desired new directory tree.
- E.Type mktree one/two/three instead of mkdir one/two/three.
- Answer & Explanation
- Report
Answer : [A, B]
Explanation :
Explanation :
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 automatically create all necessary parent directories 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.) Typing touch /bin/mkdir, as option C suggests, will likely result in an error message if typed as a normal user and won’t help if typed as root, so this option is incorrect. Clearing away existing directories in the one/two/three tree won’t help, so option D is incorrect. Option E’s mktree command is fictitious. |