101-500 Exam QuestionsBrowse all questions from this exam

101-500 Exam - Question 57


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

Show Answer
Correct Answer: B

The correct command to print a list of usernames and their primary group from the /etc/passwd file is 'cut -d : -f 1,4 /etc/passwd'. This command uses 'cut' to select specific fields from each line of the file, with '-d :' specifying that the delimiter is a colon (which is the delimiter used in the /etc/passwd file), and '-f 1,4' indicating that the first and fourth fields should be extracted, which correspond to the username and primary group respectively.

Discussion

1 comment
Sign in to comment
woonsiOption: B
Feb 12, 2023

B is the correct answer. i have test in Ubuntu. cut -d : -f 1,4 /etc/passwd