Preparing Practice Exam…
Please wait a moment while the system generates the exam questions, answers, and study session.
Please wait a moment while the system generates the exam questions, answers, and study session.
Question 41 of 42
Free Preview · 42 of 140 · questions 1–42 of 140 are free. Sign up free to sync your progress across devices.
Select one answer.
Written by other learners. Comments can disagree with the marked answer — check the official documentation when in doubt.
The command that will generate a list of user names from '/etc/passwd' along with their login shell is 'cut -d: -f1,7 /etc/passwd'. Option D is the correct answer. The 'cut' command is used to extract specific fields or columns from a file. The '-d' option specifies the delimiter, and the '-f' option specifies the fields to extract. In this case, the command will extract the first ('1') and seventh ('7') fields from '/etc/passwd', using a colon (':') as the delimiter. The '/etc/passwd' file contains a list of user accounts on the system, with each line representing a single user. The fields are separated by colons, the first field is the user name and the seventh field is the login shell. Therefore, the command will generate a list of user names from '/etc/passwd' along with their login shell.
The other options do not accurately describe the behavior of the 'cut' command: Option A: The 'column' command is used to format the output of a command into columns, but it does not have the capability to extract specific fields or columns from a file. Option B: The 'chop' command is not a standard Linux command. Option C: The 'colrm' command is used to remove specific columns from a file, but it does not have the capability to extract specific fields or columns from a file.