CHapter 4 quiz linux

Ace your homework & exams now with Quizwiz!

In order to set all of the special permissions on a certain file or directory, which command should be used on a file named filename?

chmod 7777 filename Correct. In the chmod 7777 command, the first three bits represent the SUID(4), SGID(2), and sticky(1) flags.

Which of the following commands will create a symbolic link named foo.txt to an original file named bar.txt

ln bar.txt foo.txt Correct. The ln command does not require any options to be used in order to create a hard link. The ln command should be followed by the name of the original file and then the name of the link to create.

Which of the following permissions would show for a symbolic link when displayed with the ls -l command?

lrwxrwxrwx

What argument can be used with the chmod command to add read permission and remove write permission for a group on a file?

g+r-w Correct. A "g" argument stands for a "Group." Operation "+" adds a read permission and operation "-" removes a write permission.

Which of the following options will change the ownership of files and directories recursively within a directory? (Choose all that apply.)

-R --recursive

Lynn runs the locate command and the results include many files from a directory that she doesn't want to include in her search. Which of the following files could Lynn modify so that the locate command no longer includes those results?

/etc/updatedb.conf

The Filesystem Hierarchy Standard specifies what directory as the root user's home directory?

/root Correct. A /root is the root user's home directory.

If a hard link is created to a file and then the original file is deleted, which of the following is true?

The original file will be removed while the hard link remains usable to access the contents of the file.

What is the complete path and filename for the database that is used by the locate and mlocate commands?

/var/lib/mlocate/mlocate.db Correct. The mlocate.db database used by the locate and mlocate commands is located in the /var/lib/mlocate directory.

Which of the following umask settings will result in new files receiving the default permissions -rw-------?

0177 Correct. If the x (1) for user, rwx (7) for group, and rwx (7) for others is masked off, the default permissions should be -rw-------.

Jan needs to set permissions on a file so that the owner has read, write, and execute permissions. The group should have read permissions only, and everyone else should have no access. Which of the following parameters, when used with the chmod command, would set the permissions described?

740 Correct. The permissions are set from left to right for owner, group, and everyone else. Read = 4, Write = 2, and Execute = 1. A 7 in the owner placeholder is equal to 4 + 2 + 1, or Read + Write + Execute. A 4 in the group placeholder means only the read bit is turned on. A 0 in the others placeholder means that none of the permissions are set.

What would be the result of running the command chown :root file1.txt

This would set the group ownership of file1 to root. Correct. The correct syntax is chown user:group filename. The user and group are both individually optional. You can specify one, the other, or both.

Which of these commands will set the following permissions on file1.txt? User = Read, Write, Execute Group = Read, Execute Others = Read

chmod u=rwx, g=rx, u=r file1.txt chmod 754 file1.txt Correct. The chmod command can be used to set permissions by specifying them in octal format. Read has a value of 4, write has a value of 2, and execute has a value of 1. They are in the order of user, group, and then other. You just have to add up the values of each of the permissions for each of the places. Read (4) + Write (2) + Execute (1) for the user gives us 7 as the first character. Read (4) + Execute (1) gives us 5 for the group. Read (4) only is set for all other users. The full result is 754. The syntax is important so after the chmod comes the permissions to be set followed by the filename(s).

Which of the following are valid permissions for a directory where the command chmod 1777 has been used to set the permissions on it?

drwxrwxrwt

Which of the following commands can be used to recursively search through the directory tree in search of a file that meets a set of given criteria instead of using an indexed database?

find Correct. The find command can be used to find recursively search the directory tree instead of using an indexed database of files. This means that it is a slower alternative when looking for files.

Which of the following commands can be used to recursively search a directory tree for files that meet a certain criterion without using a database or premade index of files?

find Correct. The find command does not use a database or premade index of files. It recursively searches through a directory for files that meet a certain criterion.

Which of the following commands will display all files and directories within the /var/log directory or its subdirectories which are owned by the root user? (Choose two.)

find /var/log -user root Correct. After the find command, you should specify the base directory or subdirectory where you want to limit the search to (including any subdirectories contained within), and then the user option can narrow the list of files returned to only those owned by a particular username.

Nicholas wants to verify whether a file is a hard link to a file within the same directory. Which of the following commands could he use to see information that would be helpful to make this determination?

ls -i Correct. The ls command has a -i option to show the inodes for each of the files in a directory. A hard link will have the same inode number as the original file.

Jamie has created a hard link to another file within the same directory. Which of the following commands can he use to verify that the hard link was created correctly? (Choose all that apply.)

ls -il ls -i

Mindy wants to create a new subdirectory at ~/2019projects/projectx/projectplans to start storing the initial project plans for projectx. However, this is the first project she has worked on in 2019 and the 2019projects directory does not exist yet. Which of the following commands will create the higher level directories if they do not already exist?

mkdir -p ~/2019projects/project/projectplans Correct. The -p option will create parent directories when they do not already exist.

Jim wants to rename a directory for a project that he has been working on. Which of the following commands can he use to perform that action?

mv projectx projecty Correct. The mv command can be used to move files from one directory to another, or move a file from one filename to another, thus renaming the file

Which of the following commands will delete a directory and all of the files contained within it? (Choose all that apply.)

rm -rf olddir Correct. The -r option for the rm command will recursively delete directories as well as any subdirectories contained within them, as well as files contained in any of those directories or subdirectories. The -f option is to force delete them without asking for confirmation on each file or subdirectory.

Which of the following commands can be used to update the last modified timestamp on a file, or if the file specified does not exist will create the file?

touch file.txt Correct. The touch command will update the last modified date on a file when used on a file that exists. When used on a file that does not exist, it will create a blank file

Which of the following commands will return one result of where the grep binary executable is located? (Choose two.)

type grep which grep

Jean installs a distribution of Linux on a workstation and attempts to run the locate command to find a certain file. Instead of returning the results she expected, an error message is displayed that it cannot find the mlocate.db file in its default location. Which of the following commands should Jean run in an attempt to resolve this problem?

updatedb Correct. The updatedb command is usually run daily by cron to update the default database. However, until it is run for the first time, the locate command will be unable to search an index of the files on the system. This means that it may be necessary to run the updatedb command manually before the locate command can be used for the first time.


Related study sets

Confusing Words Sets 1-5: Application

View Set

Pentest+ Lesson 9 - Exploiting the LAN and Cloud

View Set

ANTH 202 Study Questions: Chapter 4

View Set

CFA Level 1 - Section 1: Ethics - Reading 4 & 5: Introduction to the Global Investment Performance Standards (GIPS)

View Set

323 Calcium Channel Blockers Practice Questions

View Set