Linux Review Questions Chapter 4

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

What does the mv command do? (Choose all that apply.) a. It renames a file. b. It renames a directory. c. It moves a directory to another location on the filesystem. d. It moves a file to another location on the filesystem.

Answer: a, b, c, and d The mv command can be used to rename files and directories within the same directory or move files and directories to a different directory.

What must a Fedora Linux user do to run cp or mv interactively and be asked whether to overwrite an existing file? a. Just run cp or mv because they run in interactive mode by default. b. Run interactive cp or interactive mv. c. Run cp -i or mv -i. d. Run cp -interactive or mv -interactive.

Answer: a On Fedora Linux systems, a default alias is configured to ensure that the cp and mv commands run their interactive counterparts: cp -i and mv -i, respectively.

Hard links need to reside on the same filesystem, whereas symbolic links need not be on the same filesystem as their target. a. True b. False

Answer: a Since hard links share the same inode number, and inode numbers are unique to their filesystem, hard links cannot be made to files on other filesystems. Symbolic links do not share the same inode number and can be made to any file on any filesystem.

When you change the data in a file that is hard-linked to three others, _____. a. the data in the file you modified and the data in all hard-linked files are modified because they have different inodes b. the data in the file you modified as well as the data in all hard-linked files are modified because they share the same data and inode c. only the data in the file you modified is affected d. only the data in the file you modified and any hard-linked files in the same directory are affected

Answer: b Because hard links share the same inode and data section, all hard linked files are updated when you modify a single one.

What does the /var directory contain? a. various additional programs b. log files and spool directories c. temporary files d. files that are architecture-independent

Answer: b The /var directory contains files that grow in size, such as log files and spool directories (e.g., print spools).

What was created to define a standard directory structure and common file location for UNIX and Linux systems? a. POSIX b. X.500 c. FHS d. OOBLA

Answer: c The Filesystem Hierarchy Standard (FHS) is referenced by UNIX and Linux systems.

A symbolic link is depicted by an @ symbol appearing at the beginning of the filename when viewed using the ls -l command. a. True b. False

Answer: b A symbolic link is indicated by l (lowercase L) at the beginning of a long file listing.

The default permissions given by the system prior to analyzing the umask are _____ for newly created directories and _____ for newly created files. a. rw-rw-rw- and rw-rw-rw- b. rw-rw-rw- and r--r--r-- c. rw-rw-rw- and rwxrwxrwx d. rwxrwxrwx and rw-rw-rw-

Answer: d The system assigns all permissions (rwxrwxrwx) to new directories, and all permissions except for execute (rw-rw-rw-) to new files.

The which command _____. a. can only be used to search for aliases b. searches for a file in all directories, starting from the root c. is not a valid Linux command d. searches for a file only in directories that are in the PATH variable

Answer: d The which command only searches for files within the directories listed in the PATH variable.

After typing the ls -F command, you see the following line in the output: -rw-r-xr-- 1 user1 root 0 Apr 29 15:40 file1 How do you interpret the mode of file1? a. User1 has read and write, members of the root group have read and execute, and all others have read permissions to the file. b. Members of the root group have read and write, user1 has read and execute, and all others have read permissions to the file. c. All users have read and write, members of the root group have read and execute, and user1 has read permissions to the file. d. User1 has read and write, all others have read and execute, and members of the root group have read permissions to the file.

Answer: a The first three permissions apply to the owner (user1), the second three permissions apply to members of the group owner (root), and the remaining permissions apply to everyone else.

Which of the following commands will change the user ownership and group ownership of file1 to user1 and root, respectively? a. chown user1:root file1 b. chown user1 : root file1 c. chown root:user1 file1 d. chown root : user1 file1

Answer: a You can specify either user1:root or user1.root as the first argument to the chown command to change the ownership of a file to the user1 user and root group

A file has the following permissions: r----x-w-. The command chmod 143 file1 would have the same effect as the command _____. (Choose all that apply.) a. chmod u+x-r,g+r-x,o+x file1 b. chmod u=w,g=rw,o=rx file1 c. chmod u-r-w,g+r-w,o+r-x file1 d. chmod u=x,g=r,o=wx file1 e. chmod u+w,g+r-w,o+r-x file1

Answer: a, and d The 143 permissions (--xr---wx) can be obtained by subtracting r and adding x to the user category, subtracting x and adding r to the group category, and adding x to the other category. Alternatively, you can use the = symbol to set the target permissions for the user, group, and other categories to x, r, and wx, respectively.

There is no real difference between the ―S‖ and ―s‖ special permissions when displayed using the ls -l command. One just means it is on a file, and the other means that it is on a directory. a. True b. False

Answer: b The S special permission indicates that an underlying x permission has not been set, while the s special permission indicates that an underlying x permission has been set.

Only the root user can modify a file that has the immutable attribute set. a. True b. False

Answer: b The immutable attribute ensures that a file cannot be modified by any user or process on the system.

The command chmod 317 file1 would produce which of the following lines in the ls command? a. --w-r--rwx 1 user1 root 0 Apr 29 15:40 file1 b. --wx--xrwx 1 user1 root 0 Apr 29 15:40 file1 c. -rwxrw-r-x 1 user1 root 0 Apr 29 15:40 file1 d. --w-rw-r-e 1 user1 root 0 Apr 29 15:40 file1

Answer: b The permissions in a mode are represented by the numbers r (4), w (2), and x (1). Thus, 3 = wx (2+1), 1 = x, and 7 = rwx (4+2+1).

When applied to a directory, the SGID special permission _____. a. allows users the ability to use more than two groups for files that they create within the directory b. causes all new files created in the directory to have the same group membership as the directory, and not the entity that created them c. causes users to have their permissions checked before they are allowed to access files in the directory d. cannot be used because it is applied only to files

Answer: b When set on a directory, the SGID ensures that newly created files and subdirectories within are configured with the same group owner of the directory.

Given the following output from the ls command, how many other files are hard linked with file3? drwxr-xr-x 3 root root 4096 Apr 8 07:12 Desktop -rw-r--r-- 3 root root 282 Apr 29 22:06 file1 -rw-r--r-- -rw-r--r-- -rw-r--r-- -rw-r--r-- -rw-r--r-- a. one b. two c. three d. four

Answer: c A link count of 4 indicates that four files share the same inode. Thus, there must be three other files that share the same inode as file3.

After typing the command umask 731, the permissions on all subsequently created files and directories will be affected. In this case, what will be the permissions on all new files? a. rw-rw-rw- b. rwxrw-r-- c. ---r--rw- d. ----wx--x

Answer: c New files receive rw-rw-rw- from the system less the umask. A umask of 731 will remove rwx-wx--x from these permissions (if present), leaving ---r--rw-.

You noticed a file in your home directory that has a + symbol appended to the mode. What does this indicate? a. Special permissions have been set on the file. b. The file has one or more files on the filesystem that are hard linked to it. c. The sticky bit directory permission has been set on the file and will remain inactive as a result. d. Additional entries exist within the ACL of the file that can be viewed using the getfacl command.

Answer: d A + symbol next to the mode of a file indicates that additional users and/or groups have been added to the access control list (ACL). You can use the getfacl command to view the full ACL.

The root user utilizes the chown command to give ownership of a file to another user. What must the root user do to regain ownership of the file? a. Have the new owner run chgrp and list the root user as the new owner. b. Run chgrp again listing the root user as the new owner. c. Nothing, because this is a one-way, one-time action. d. Run chown and list the root user as the new owner.

Answer: d The root user can modify the ownership of any file or directory on the system.


संबंधित स्टडी सेट्स

Chapter 12 The Case Managers Professional Growth and Development

View Set

Unit 2, Personal Transmission and Risk Factors

View Set

CH. 11 Information and Data Management

View Set

Geography (MICRONESIA, MELANESIA, AND POLYNESIA)

View Set

Religion, Chapter 6, The Patriarchs

View Set