Skip to main content
Linux AdministrationMediumSingle Choice

Linux Administration Question

Statement

Which of the following commands prints a list of usernames (first column) and their primary group (fourth column) from the /etc/passwd file?

#cut#/etc/passwd#field extraction#delimiter
A

fmt -f 1,4 /etc/passwd

B

split -c 1,4 /etc/passwd

C

cut -d : -f 1,4 /etc/passwd

Correct

Resolution & Explanations

The /etc/passwd file uses a colon (:) as a delimiter. The cut command with -d : specifies this delimiter, and -f 1,4 selects the 1st (username) and 4th (GID) fields.