LPIC-1 Exam 101 (Linux Administrator) — Question 43
Which of the following commands prints a list of usernames (first column) and their primary group (fourth column) from the /etc/passwd file?
Answer options
- A. fmt -f 1,4 /etc/passwd
- B. split -c 1,4 /etc/passwd
- C. cut -d : -f 1,4 /etc/passwd
- D. paste -f 1,4 /etc/passwd
Correct answer: C
Explanation
The correct command is 'cut -d : -f 1,4 /etc/passwd', which uses a delimiter to extract specific fields from each line in the file. The other options, fmt, split, and paste, do not serve the purpose of extracting specific fields from a delimited file like /etc/passwd.