LPIC-1 Exam 101 v5 (Linux Administrator) — Question 109

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

Correct answer: B

Explanation

The correct command is B, as 'cut' is specifically designed to extract sections from each line of a file based on a specified delimiter, in this case, ':' for the /etc/passwd file. The other commands do not serve this purpose: A uses 'fmt', which formats text, C sorts data rather than extracting it, D pastes lines together, and E splits files rather than extracting fields.