LPIC-1 Exam 101 v5 (Linux Administrator) — Question 117
Which of the following commands generates a list of user names from /etc/passwd along with their login shell?
Answer options
- A. column -s : 1,7 /etc/passwd
- B. chop -c 1,7 /etc/passwd
- C. colrm 1,7 /etc/passwd
- D. sort -t: -k1,7 /etc/passwd
- E. cut -d: -f1,7 /etc/passwd
Correct answer: E
Explanation
The correct answer is E because the 'cut' command is specifically designed to extract sections from each line of a file. Options A, B, C, and D do not provide the functionality to extract the required fields; they either format output, remove columns, or sort data but do not isolate the user names and login shells from the /etc/passwd file.