Module 3: Linux Commands in the Bash Shell

Q: What are the arguments in grep bmoreno Q4users.txt? Select two answers.

  • 4users.txt 
  • grep
  • bmoreno 
  • .txt
Explanation: You may think of this as the pattern or text that grep looks for inside the Q4users.txt file. This is the file that grep reads over to look for instances of the pattern bmoreno.

Q: What is the root directory?

  • The highest-level directory in Linux
  • The command to navigate between directories
  • The home directory of a specific user with no privileges
  • A subdirectory of the home directory
Explanation: / is the symbol that represents the root directory in the Linux file system hierarchy. This directory is the beginning point for all other directories and files in the system. In addition to being the top-level directory that covers everything else, it is also the directory that contains all of the other directories and files in the system.

Q: A security analyst enters grep OS updates.txt into the command line. What does this tell the operating system to do?

  • Move the updates.txt file to the OS directory
  • Create a new file named updates.txt in the OS directory
  • Search through the updates.txt file and return all lines containing the string OS (CORRECT)
  • Create a new directory named OS and a new file named updates.txt
Explanation: Instructing the operating system to scan through the file updates.txt for any lines that include the term "OS" is what the command grep OS updates.txt does. It does not include the creation of new files, the creation of new directories, or the movement of existing files.

Q: A security analyst enters touch updates.txt into the command line. What does this tell the operating system to do?

  • Open the updates.txt file
  • Create a new file named updates.txt in their current directory
  • Move the updates.txt file out of their current directory
  • Create a new file named updates.txt and move it to the root directory
Explanation: Using the touch command on operating systems that are similar to Unix, such as Linux, it is possible to either create a file that is empty if it does not already exist or change the access and modification timestamps of a file. Therefore, when a security analyst types touch updates.txt, it guarantees that a file with the name updates.txt is created in the directory that is now being used, regardless of whether or not the file has been there in the past.

Q: What are the three types of permissions?

  • Root, user, and group
  • User, group, and other
  • Read, write, and execute 
  • Read, write, and save
Explanation: Permissions that are available to the person who is the owner of the directory or file. These are the permissions that have been given to the group that is connected with the directory or file. The permissions are provided to anybody else who does not fit within the categories that have been discussed above.

Q: A security analyst enters chmod u+w,g-r access.txt into the command line. What does this command do?

  • It adds write permissions for the group and removes read permissions for the user on the access.txt file.
  • It adds write and read permissions for the user and group on the access.txt file.
  • It removes write and read permissions for the user and group on the access.txt file.
  • It adds write permissions for the user and removes read permissions for the group on the access.txt file. 
Explanation: Specifically, it removes read rights for the group on the access.txt file while simultaneously adding write permissions for the user.

Q: Which of the following commands require the user to be a root user or have sudo privileges? Select two answers.

  • cd
  • useradd 
  • grep
  • userdel 
Explanation: To add a new user to the system, which is a process that needs administrator rights, this command takes place. In addition to needing administrator credentials to manage user accounts, this command is used to remove a user account from the system it is associated with.

Q: Given the following permissions drw-rw-r–, what permissions does the group have? Select all that apply.

  • Write 
  • Use
  • Read 
  • Execute
Explanation: In the normal Unix and Linux permissions, the "Use" permission is not as stated as it would be. In this particular instance, the group does not have the authorization to execute (x) (r-- denotes read-only for others, not execute).

Q: What are the arguments in cp vulnerabilities.txt /home/analyst/projects? Select two answers.

  • vulnerabilities.txt 
  • cp
  • /home
  • /home/analyst/projects 
Explanation: The directory or file that makes up the source is the one that is being copied.We will copy the vulnerabilities.txt file to this directory, which is the target location.

Q: Which command searches a specified file and returns all lines in the file containing a specified string?

  • sudo
  • pwd
  • grep (CORRECT)
  • mkdir
Explanation: The grep command is the one that examines a certain file and returns all of the lines in that file that contain a particular string. It is usual practice to use the "global regular expression print" (grep) command to search for patterns or strings inside files.

Q: Which of the following are types of permissions? Select all that apply.

  • Write 
  • Execute 
  • Read 
  • Authorize
Explanation: It is not common practice to use the word "authorize" when referring to permissions in this context. It might be a reference to authentication or authorization to carry out operations, but it is not a sort of permission that is associated with the file system.

Q: A security analyst enters chmod u+w,g-r access.txt into the command line. What does this command tell the operating system to do? Select all that apply.

  • Remove read permissions from the user for the access.txt file
  • Add write permissions to the user for the access.txt file
  • Add write permissions to the group for the access.txt file
  • Remove read permissions from the group for the access.txt file 
Explanation: Adding write permission to the user using the u+w shortcut is correct.The right answer is that the g-r command removes read permission for the group.

Q: What does sudo do?

  • Changes the owner associated with a particular file
  • Temporarily grants elevated permissions to specific users 
  • Adds users to the system
  • Deletes users from the system
Explanation: Utilizing the sudo command on operating systems that are similar to Unix, it is possible to temporarily provide elevated rights (often root or superuser access) to certain users. Users will be able to run commands that need administrator access, such as installing software, altering system files, or doing other administrative operations. This will enable users to execute commands.

Q: Which of the following commands searches the manual page descriptions for a specified string?

  • cp
  • apropos 
  • man
  • pwd
Explanation: To find a certain string, the apropos command looks through the manual page names and descriptions file. It helps locate instructions that are pertinent to a certain subject.

Q: Given the following permissions drw-rw-r–, what does the fourth character represent?

  • The group does not have execute permissions for this directory
  • The user has execute permissions for this directory
  • The group has execute permissions for this directory
  • The user does not have execute permissions for this directory
Explanation: In the permissions drw-rw-r--, the fourth character specifies the permissions for the owner (user) of the directory about execute permissions. 

Q: What are the arguments in mv Q1users.txt /home/analyst/reports? Select two answers.

  • mv
  • Q1users.txt 
  • /home/analyst/reports 
  • .txt
Explanation: This is the directory or file that is functioning as the source for the transfer. We will be moving the file Q1users.txt to this directory, which is the target location.

Q: Fill in the blank: The highest-level directory in Linux is called the _____.

  • sudo
  • permissions
  • root directory 
  • home directory
Explanation: Linux's root directory is the directory that has the highest degree of access. The symbol for this directory is /, and it is the point at which the file system hierarchy begins on operating systems that are similar to Unix.

Q: A security analyst is updating permissions on the file access.txt. They want to add write permissions for the user and remove read permissions for the group.  What do they enter on the command line?

  • chmod u+w,g-r access.txt 
  • chmod u+rw,g-rw access.txt
  • chmod access.txt u+w,g-r
  • chmod u-w,g+r access.txt
Explanation: To remove read rights for the group and add write permissions for the user on the file access.txt, the security analyst should execute the following command.

Q: Which command can you use to change your current directory?

  • ls
  • cat
  • pwd
  • cd 
Explanation: Use the cd command to change the directory that you are currently working in.

Post a Comment

Previous Post Next Post