List all Username and User ID using Bash Command


In order to get a list of all usernames and User IDs on your Amazon Linux, Ubuntu, Fedora, or any other Linux distribution you have to take a look at the /etc/passwd

Example: using cut command:
# cut -d: -f-1,3 /etc/passwd
root:0
bin:1
daemon:2
adm:3
lp:4
sync:5
shutdown:6
halt:7
mail:8
operator:11
games:12
ftp:14
nobody:99

-d -> delimiter option

: -> is the delimter

-f -> is the field option

1 -> Username and 3 -> User ID

Get List of All Username and User ID
-


Have Questions? Post them here!

Topics Coverage:


🎉 We are celebrating the 10th years of Code2care! Thank you for all your support!

We strongly support Gender Equality & Diversity.

Follow Us: GitHub | Facebook | Twitter | Instagram