1.
A symbolic link is also known as a soft link and is depicted by an @ appearing at the beginning of the filename when viewed using the ls –l command. True or False?
Correct Answer
B. False
Explanation
A symbolic link is also known as a soft link, but it is not depicted by an @ appearing at the beginning of the filename when viewed using the ls –l command.
2.
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 that it is on a directory. True or False?
Correct Answer
B. False
Explanation
False. The "S" and "s" special permissions do have a difference when displayed using the ls -l command. The lowercase "s" indicates that the setgid permission is set on a directory, while the uppercase "S" indicates that the setgid permission is not set on a file, but the execute permission is set.
3.
The default permissions given by the system prior to analyzing the umask are ___________for directories, and __________ for files.
Correct Answer
D. Rwxrwxrwx and rw-rw-rw-
Explanation
The default permissions given by the system prior to analyzing the umask are "rwxrwxrwx" for directories and "rw-rw-rw-" for files.
4.
What must a user do to run cp or mv interactively and be asked if she wants to overwrite an existing file?
Correct Answer
E. Just type cp or mv as they run in interactive mode by default.
Explanation
The correct answer is "Just type cp or mv as they run in interactive mode by default." This means that when the user runs the cp or mv command, they will be prompted to confirm if they want to overwrite an existing file.
5.
A user utilizes the chgrp command to give ownership of a file to another user. What must the user do to regain ownership of the file?
Correct Answer
C. Have the new owner run chgrp and list the original owner as the new owner.
6.
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
What does this mean?
Correct Answer
A. User1 has read and write, members of the root group have read and execute, and all others have read permissions to the file.
Explanation
The output line "-rw-r-xr-- 1 user1 root 0 Apr 29 15:40 file1" represents the file permissions. The first character "-" indicates that it is a regular file. The next three characters "rw-" indicate that the owner, user1, has read and write permissions. The next three characters "r-x" indicate that the members of the root group have read and execute permissions. The last three characters "r--" indicate that all others have read permissions. Therefore, the correct answer is that user1 has read and write, members of the root group have read and execute, and all others have read permissions to the file.
7.
After typing the command umask 731, the permissions on all subsequently created files and directories will be effected. In this case, what will the permissions on all new files be?
Correct Answer
C. ---r--rw-
Explanation
After typing the command umask 731, the umask value will be applied to the default permissions of all subsequently created files and directories. The umask value is subtracted from the default permissions to determine the final permissions. In this case, the umask value is 731, which means that the permissions for the group and others will be affected. The default permissions are rw-rw-rw-, and subtracting 731 from it results in ---r--rw-. Therefore, the permissions on all new files will be ---r--rw-.
8.
When you change the data in a file that is hard-linked to three others, __________.
Correct Answer
D. The data in the file you modified as well as the data in all hard linked files are modified as they share the same data and all have the same inode and file size.
Explanation
When you change the data in a file that is hard-linked to three others, the data in the file you modified as well as the data in all hard-linked files are modified. This is because hard links are essentially multiple names for the same file, sharing the same data and inode. Therefore, any changes made to the file will be reflected in all the hard-linked files since they all point to the same underlying data.
9.
The command chmod 317 file1 would produce which of the following lines in the ls command?
Correct Answer
B. --wx--xrwx 1 user1 root 0 Apr 29 15:40 file1
10.
Which of the following commands will change the user ownership and group ownership of file1 to user1 and root respectively?
Correct Answer
A. Chown user1:root file1
Explanation
The correct answer is "chown user1:root file1". This command will change the user ownership of "file1" to "user1" and the group ownership to "root".
11.
What does the /var directory contain?
Correct Answer
B. Spools and log files
Explanation
The /var directory contains spools and log files. Spools are temporary storage areas where data is held before being processed or printed. Log files record events and activities on the system, providing a history of actions and errors for troubleshooting purposes. These files are typically found in the /var directory to keep them separate from other system files and to allow for easy management and access.
12.
What does the mv command do? (Choose all that apply.)
Correct Answer(s)
C. It moves a directory.
D. It moves a file.
Explanation
The mv command is used to move files or directories from one location to another. It can be used to move both directories and files. Therefore, the correct answers are "It moves a directory" and "It moves a file."
13.
A file has the following permissions r----x-w-. The command chmod 143 would have the same effect as the command _______________. (Choose all that apply.)
Correct Answer
D. Chmod u=x,g=r,o=wx file1
Explanation
The given file has the permissions r----x-w-. The command chmod 143 would have the same effect as the command chmod u=x,g=r,o=wx file1 because it sets the permissions for the user to execute, for the group to read, and for others to write and execute.
14.
- The which command _________________?
Correct Answer
D. Searches for a file only in directories that are in the PATH variable
Explanation
The "which" command is used to search for the location of a command or executable file in the directories listed in the PATH variable. It does not search for files in all directories starting from the root, nor is it limited to searching for executables only. Therefore, the correct answer is that "which" searches for a file only in directories that are in the PATH variable.
15.
Hard links need to reside on the same filesystem as the target, whereas symbolic links need not be on the same filesystem as the target. True or False?
Correct Answer
A. True
Explanation
Hard links are file system links that point directly to the target file. They are essentially the same file with multiple names. Hard links must reside on the same file system as the target because they reference the target's physical location on the disk. On the other hand, symbolic links are file system links that point to the target file by its path. Symbolic links can be created on different file systems as they do not reference the target's physical location. Therefore, the statement "Hard links need to reside on the same filesystem as the target, whereas symbolic links need not be on the same filesystem as the target" is true.
16.
When applied to a directory, the SGID special permission____________________.
Correct Answer
A. Causes all new files created in the directory to have the same group membership as the directory and not the entity that created them
Explanation
The SGID special permission, when applied to a directory, ensures that any new files created within that directory will inherit the same group membership as the directory itself. This means that the group ownership of the directory will be applied to the new files, rather than the group ownership of the user who created them. This can be useful in situations where multiple users need to collaborate on files within a shared directory, as it allows for consistent group ownership and access permissions.
17.
Which command do you use to rename files and directories?
Correct Answer
B. Mv
Explanation
The correct answer is "mv". The "mv" command is used to rename files and directories in a Unix or Linux operating system. By using this command, you can change the name of a file or directory to a new name of your choice. It is a versatile command that can also be used to move files and directories to different locations in the file system.
18.
What are the three standard Linux permissions?
Correct Answer
C. Execute, read, write
Explanation
The three standard Linux permissions are execute, read, and write. These permissions determine the level of access a user has to a file or directory. The execute permission allows a user to run a file or access a directory. The read permission allows a user to view the contents of a file or directory. The write permission allows a user to modify or delete a file or directory.
19.
Given the following output from the ls command, how many files are linked with file1?
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-- 1 root root 282 Apr 29 22:06 file2
-rw-r--r-- 4 root root 282 Apr 29 22:06 file3
-rw-r--r-- 2 root root 282 Apr 29 22:06 file4
-rw-r--r-- 1 root root 282 Apr 29 22:06 file5
-rw-r--r-- 1 user1 sys 282 Apr 29 22:06 file6
Correct Answer
B. Two
Explanation
Two files are linked with file1. This can be determined by looking at the output of the ls command. The lines that start with "drwxr-xr-x" and "rw-r--r--" are not relevant to the question as they represent directories and permissions. The lines that start with "rw-r--r--" and have "root" as the owner are the files. In this case, file1 and file2 are the only files that meet this criteria. Therefore, the answer is two.