DevNet Associate 1.2.3 Quiz – Linux Review (Answers)

DevNet Associate 1.2.3 Quiz Module 1 Quiz – Linux Review (Answers)

1. What Linux command is used to display the contents of the current directory?

  • pwd
  • cat
  • ln
  • ls

Explanation: The Linux ls command, without any options, is used to display the contents, such as files and subdirectories, of the current directory.

2. What command is used to rename a file in a Linux system?

  • mv
  • dd
  • cp
  • rm

Explanation: The mv Linux command can be used to move a file to another directory or rename a file. The cp command is used to make a copy of files or directories. The dd command is also used to make a copy of a file. The rm command is used to delete a file.

3. A user issues a Linux command and the result is shown.

total 40
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Videos
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Templates
drwxr-xr-x 5 devasc devasc 4096 Mar 30 21:24 snap
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Public
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Pictures
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Music
drwxr-xr-x 5 devasc devasc 4096 Mar 30 21:21 labs
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Downloads
drwxr-xr-x 2 devasc devasc 4096 Apr 15 19:09 Documents
drwxr-xr-x 2 devasc devasc 4096 Mar 30 21:25 Desktop
devasc@labvm:~$

Which Linux command is used to display the contents of the current directory as shown?

  • ls -l
  • ls -a
  • ls -lr
  • ln

Explanation: The Linux ls command with the -l option is used to display contents in the current directory as a “long list”. By default, the listing is sorted alphabetically. With both the -l and -r options specified, the listing is displayed as a long list and in reverse order.

4. A system administrator of a Linux server is searching the passwd file for the username taylor that appears at the beginning of the line. Which grep command should the administrator use?

  • grep taylor /etc/passwd
  • grep ‘.taylor’ /etc/passwd
  • grep ‘^taylor’ /etc/passwd
  • grep ‘[taylor]’ /etc/passwd

Explanation: The Linux grep command can be used to process text line by line and to print any lines which match a specified pattern. The matching patterns are based on regular expression (regex) query modifiers used to select the appropriate content. Some regex query modifiers are as follows:
(underscore): matches a space
^ (caret): indicates the start of a string
$ (dollar sign): indicates the end of a string
. (period): matches a single character, including a space
(asterisk): matches zero or more occurrences of the preceding character
(square bracket): matches a character
{ } (curly bracket): repeats preceding character

5. A user issues the apt-get upgrade command to update system files in a Ubuntu Linux system and receives an error message of “permission denied.” What should the user do to complete the task?

  • Issue the allow apt-get upgrade command.
  • Issue the sudo apt-get install command.
  • Issue the apt-get install –allow command.
  • Issue the sudo apt-get upgrade command.

Explanation: There are several Linux commands in the Advanced Package Tool (APT) system to perform software package management tasks. The apt-get upgrade command is used to update all packages and dependencies on the system. This command must be run with administrative level permissions, which are provided by the sudo command.

Subscribe
Notify of
guest

0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x