Chapter 4 Review Questions

Lakukan tugas rumah & ujian kamu dengan baik sekarang menggunakan Quizwiz!

1. Why might you type touch filename? A. To move filename to the current directory B. To ensure that filename's time stamp 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

1. B. 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.

10. Typing ls -ld wonderjaye reveals a symbolic file mode of drwxr-xr-x. Which of the following are true? (Select two.) A. wonderjaye is a symbolic link. B. wonderjaye is an executable program. C. wonderjaye is a directory. D. wonderjaye has its SUID bit set. E. wonderjaye may be read by all users of the system.

10. C, E. The d character that leads the mode indicates that the file is actually a directory (option C), and the r symbol in the r-x triplet at the end of the symbolic mode indicates that all users of the system have read access to the directory (option E). Leading l characters, which this mode lacks, denote a symbolic link, so option A is incorrect. Although the x symbols usually denote executable program files, as specified in option B, in the case of directories this permission bit indicates that the directory's contents may be searched; executing a directory is meaningless. SUID bits are indicated by an s character in place of the owner's execute bit position in the symbolic mode. Since this position holds an x in this example, option D is incorrect.

11. When should programs be configured SUID root? A. At all times. This permission is required for executable programs. B. Whenever a program should be able to access a device file. C. Only when they require root privileges to do their job. D. Never. This permission is a severe security risk E. Whenever the program file is owned by the root user.

11. C. The set user ID (SUID) bit enables programs to run as the program's owner rather than as the user who ran them. This makes SUID root programs risky, so setting the SUID bit on root-owned programs should be done only when it's required for the program's normal functioning, as stated in option C. This should certainly not be done for all programs because the SUID bit is not required of all executable programs, as option A asserts. Although the SUID root configuration does enable programs to access device files, the device files' permissions can be modified to give programs access to those files, if this is required, so option B is incorrect. Although SUID root programs are a security risk, as stated in option D, they're a necessary risk for a few programs, so option D goes too far. Many program files that should not be SUID root are owned by root, so option E is incorrect.

12. Which of the following commands would you type to enable world read access to the file myfile.txt? (Assume that you're the owner of myfile.txt.) A. chmod 741 myfile.txt B. chmod 0640 myfile.txt C. chmod u+r myfile.txt D. chmod a-r myfile.txt E. chmod o+r myfile.txt

12. E. Using symbolic modes, the o+r option adds read (r) permissions to the world (o). Thus, option E is correct. Option A sets the mode to rwxr----x, which is a bit odd and doesn't provide world read access to the file, although it does provide world execute access. Option B sets the mode to rw-r-----, which gives the world no access whatsoever to the file. Option C adds read access to the file for the owner (u) if the owner doesn't already have this access; it doesn't affect the world permissions. Option D removes read access for all users, so it's incorrect.

13. Which of the following umask values will result in files with rw-r----- permissions? A. 640 B. 210 C. 022 D. 027 E. 138

13. D. Files start with a 666 permission bit octal number setting. Depending upon the umask setting, permission bits may be removed, but not added. Option D, 027, removes write permissions for the group and all world permissions. (Files normally don't have execute permissions set, but explicitly removing write permissions when removing read permissions ensures reasonable behavior for directories.) Therefore, Option D is correct. Option A, 640, is the octal equivalent of the desired rw-r----- permissions, but the umask sets the bits that are to be removed from permissions, not those that are to be set. Option B, 210, would remove write permission for the owner, but it wouldn't remove write permission for the group, which is incorrect. This would also leave all world permissions open. Option C, 022, wouldn't remove world read permission. Option E, 138, is an invalid umask because all the digits in the umask must be between 0 and 7.

14. You see the usrquota and grpquota options in the /etc/fstab entry for a filesystem. What is the consequence of these entries? A. Quota support will be available if it's compiled into the kernel; it will be automatically activated when you mount the filesystem. B. User quotas will be available, but the grpquota option is invalid and will be ignored. C. Quota support will be disabled on the filesystem in question. D. Nothing. These options are malformed and so will have no effect. E. Quota support will be available if it's compiled into your kernel, but you must activate it with the quotaon command.

14. E. Using quotas requires kernel support, the usrquota or grpquota (for user or group quotas) filesystem mount option, and activation via the quotaon command (which often appears in system startup scripts). Thus, option E is correct. Option A suggests that quotaon is not necessary, which is incorrect. Option B's statement that grpquota is invalid is incorrect. Option C's statement that these options disable quota support is backward. The usrquota and grpquota options are both valid, so option D is incorrect.

15. Which of the following commands can be used to summarize the quota information about all filesystems? A. repquota B. repquota -a C. quotacheck D. quotacheck -a E. edquota -a

15. B. The repquota utility is used to summarize the quota information about the filesystem. When used with the -a option, it shows this information for all filesystems, so option B is correct. This command won't return useful information when typed alone, though, so option A is incorrect. The quotacheck utility checks quota information about a disk and writes corrections, so options C and D are both incorrect. The edquota utility enables you to edit quota information. It doesn't summarize quota information, and -a isn't a valid option to edquota. Thus, option E is incorrect.

16. You've installed a commercial spreadsheet program called WonderCalc on a workstation. In which of the following directories are you most likely to find the program executable file? A. /usr/sbin B. /etc/X11 C. /boot D. /opt/wcalc/bin E. /sbin/wcalc

16. D. The /opt directory tree exists to hold programs that aren't a standard part of a Linux distribution, such as commercial programs. These programs should install in their own directories under /opt; these directories usually have bin subdirectories of their own, although this isn't required. Thus, option D is correct (that is, it's a plausible possibility). The /usr/sbin directory holds programs that are normally run only by the system administrator, so it's not a likely location, making option A incorrect. The /etc/X11 directory holds X-related configuration files; so it's very unlikely that WonderCalc will be housed there, making option B incorrect. The /boot directory holds critical system boot files, so option C is incorrect. The /sbin directory, like /usr/sbin, is an unlikely location for user files, so option E is incorrect. (Furthermore, /sbin seldom contains subdirectories.)

17. Which of the following file-location commands is likely to take the most time to find a file that may be located anywhere on the computer (assuming the operation succeeds)? A. The find command. B. The locate command. C. The whereis command. D. The type command. E. They're all equal in speed.

17. A. The find utility (option A) operates by searching all files in a directory tree, and so it's likely to take a long time to search all of a computer's directories. The locate program uses a precompiled database, whereis searches a limited set of directories, and type searches the shell's path and built-in commands, so these commands will take less time. Thus, options B, C, D, and E are all incorrect.

18. What can the type command do that whereis can't? A. Identify the command as being for x86 or x86-64 CPUs B. Locate commands based on their intended purpose, not just by name C. Identify a command as an alias, internal command, or external command D. Assist in typing a command by finishing typing it for you E. Identify a command as being a binary or a script

18. C. The type command identifies a command, as executed by the shell, as being a built-in shell command, a shell alias, or an external command, whereas the whereis command helps find the location of external command files, thus option C is correct. Neither type nor whereis identifies the CPU architecture of a program file, can locate commands based on intended purpose, complete an incompletely typed command, or identify a command as a binary or a script; thus, the remaining options are all incorrect.

19. You want to track down all of the files in /home that are owned by karen. Which of the following commands will do the job? A. find /home -uid karen B. find /home -user karen C. locate /home -username karen D. locate /home Karen E. find /home -name Karen

19. B. The find command includes the ability to search by username using the -user name option, where name is the username; thus option B is correct. The -uid option to find can also locate files owned by a user, but it takes a numeric user ID (UID) as an argument, so option A isn't quite correct. The locate command provides no ability to search by user, so options C and D are incorrect. Although option E is a valid find command, it finds all of the files under /home with a filename of karen, not all files owned by the user karen, so this option is incorrect.

2. What parameter can you pass to ln to create a soft link? (Select two.) A. -s B. --soft C. --slink D. --symbolic E. --sl

2. A, D. 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 don't exist.

20. What can you conclude from the following interaction? $ which man /usr/bin/man A. The only file called man on the computer is in /usr/bin. B. The /usr/bin/man program was installed by system package tools. C. The /usr/bin/man program will be run by any user who types man. D. The first instance of the man program, in path search order, is in /usr/bin. E. The user man owns the /usr/bin/man program file

20. D. The which program searches the path just as bash does, but it prints the path to the first executable program it finds on the path. Thus option D is correct. The which program doesn't conduct an exhaustive search of the system, so there could be many more files called man on the system, contrary to option A. System package tools and which aren't closely related; option B is incorrect. Although /usr/bin/man would be run when the user whose which output matches that in the question types man, this may not be true of others because the path can vary from one user to another, thus option C is incorrect. The which program doesn't reveal file ownership information, so option E is incorrect.

3. 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

3. A. 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.

4. 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.

4. D. 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 USB flash 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.

5. 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.

5. 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.) 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.

6. Which of the following commands are commonly used to create archive files? (Select two.) A. restore B. vi C. tape D. cpio E. tar

6. D, E. The cpio and tar programs are common Linux archive-creation utilities, so options D and E are both correct. The restore command restores (but does not back up) data; its backup counterpart command is dump. Thus, option A is incorrect. The vi command launches a text editor; it's not used to create archives, so option B is incorrect. There is no standard tape command in Linux, so option C is incorrect.

7. You've received a tar archive called data79.tar from a colleague, but you want to check the names of the files it contains before extracting them. Which of the following commands would you use to do this? A. tar uvf data79.tar B. tar cvf data79.tar C. tar xvf data79.tar D. tar rvf data79.tar E. tar tvf data79.tar

7. E. With the tar utility, the --list (t) command is used to read the archive and display its contents. The --verbose (v) option creates a verbose file listing, and --file (f) specifies the filename—data79.tar in this case. Option E uses all of these features. Options A, B, C, and D all substitute other commands for --list, which is required by the question.

8. You want to create a link from your home directory on your hard disk to a directory on a DVD drive. Which of the following link types might you use? A. Only a symbolic link B. Only a hard link C. Either a symbolic or a hard link D. Only a hard link, and then only if both directories use the same low-level filesystem E. None of the above; such links aren't possible under Linux

8. A. Symbolic links can point across filesystems, so creating a symbolic link from one filesystem (in which your home directory resides) to another (on the DVD) isn't a problem, making option A correct. Hard links, as in options B, C, and D, are restricted to a single filesystem and so won't work for the described purpose. Because symbolic links will work as described, option E is incorrect.

9. What command would you type (as root) to change the ownership of somefile.txt from ralph to tony? A. chown ralph:tony somefile.txt B. chmod somefile.txt tony C. chown somefile.txt tony D. chmod tony:ralph somefile.txt E. chown tony somefile.txt

9. E. Option E is the correct command. Typing chown ralph:tony somefile.txt, as in option A, sets the owner of the file to ralph and the group to tony. The chmod command used in options B and D is used to change file permissions, not ownership. Option C reverses the order of the filename and the owner.


Set pelajaran terkait

describe the key components of the human resources management process and important influences on that process

View Set

World History Chapter 3 Text Questions

View Set