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

Facing issues? Have Questions? Post them here! I am happy to answer!

Author Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail: rakesh@code2care.org



















Copyright © Code2care 2024 | Privacy Policy | About Us | Contact Us | Sitemap