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 (first column) and their primary group (fourth column) from the /etc/passwd file is 'cut -d : -f 1,4 /etc/passwd'. The 'cut' command is used to extract specific fields from each line of a file. The '-d :' option specifies that the delimiter is a colon, which is the character used to separate fields in the /etc/passwd file. The '-f 1,4' option indicates that we want to extract the first and fourth fields. This will properly extract and display the username and primary group information from the file.
The command that prints a list of usernames (first column) and their primary group (fourth column) from the /etc/passwd file is: C. `cut -d : -f 1,4 /etc/passwd` In this command: - `cut` is used to select specific columns. - `-d :` specifies the delimiter as a colon since the /etc/passwd file uses colons to separate fields. - `-f 1,4` specifies that we want to extract the first (username) and fourth (primary group) fields. This command will extract and display the desired information from the /etc/passwd file.