Which of the following commands prints a list of usernames (first column) and their primary group (fourth column) from the /etc/passwd file?
Which of the following commands prints a list of usernames (first column) and their primary group (fourth column) from the /etc/passwd file?
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.
B is the correct answer. i have test in Ubuntu. cut -d : -f 1,4 /etc/passwd