How to list only the usernames in the /etc/passwd file on Linux.

To list only the usernames in the /etc/password file use this command.

[email protected]:~$ cut -d: -f1 /etc/passwd

This will print a listing of all usernames.

This also works on the /etc/shadow file when used as root.

[email protected]:~$ su -c 'cut -d: -f1 /etc/shadow'
Password:

No comments have been made. Use this form to start the conversation :)

Leave a Reply