What command will print a list of usernames (first column) and their corresponding user id (uid, third column) from /etc/passwd?

What command will print a list of usernames (first column) and their corresponding user id (uid, third column) from /etc/passwd?

What command will print a list of usernames (first column) and their corresponding user id (uid, third column) from /etc/passwd?

A.
cut -d: -f1,3 /etc/passwd

B.
chop -c 1,3 /etc/passwd

C.
tac 1-3 /etc/passwd

D.
fmt -u /etc/passwd

Explanation:
From the man pages:
cut – remove sections from each line of files

/etc/passwd entries are seperated by ":", so use option "-d:" and use -f to only get specific columns.



Leave a Reply 0

Your email address will not be published. Required fields are marked *