Skip to content
Follow
Ubuntu Linux

How to Retrieve User IDs in Ubuntu Linux

Richard
Written by
Richard
Jan 5, 2023 Updated Jul 14, 2026 3 min read
How to Use Sticky Notes in Windows 11
How to Use Sticky Notes in Windows 11

Retrieving user IDs (UIDs) in Ubuntu Linux lets you find the unique number assigned to each account on your system.

Every user account on Ubuntu gets a special number, the User ID or UID. The system uses this number to identify who is who and manage their access to files and programs.

To find your own UID, just open the terminal and type `id -u`. This command immediately shows you your specific number.

If you need to see a list of all UIDs for every account on your Ubuntu system, use the `getent passwd` command. This is handy for checking other users’ IDs or managing your system.

⚡ Quick Answer

You can find your user ID by opening the terminal and typing `id`. To see all user IDs, use `lslogins -u` or `getent passwd `.

Get UID for Users on Ubuntu Linux

Your Ubuntu Linux system uses a User ID, or UID, to keep track of each user.

To find your user ID, run the `id` command shown below.

💻Code
id

You’ll see output similar to this:

💻Code
uid=1000(richard) gid=1000(richard) groups=1000(richard),4(adm),24(cdrom),27(sudo),30(dip),46(plugdev),122(lpadmin),134(lxd),135(sambashare)

Use the lslogins command to find the User ID

The `lslogins` command in Ubuntu retrieves user IDs for multiple people on your system at once. Typing `lslogins -u` into your terminal shows a list of all the user IDs (UIDs) and their corresponding usernames, making it easy to see who has which ID.

Run the `lslogins` command below to list all UIDs on the system.

💻Code
lslogins -u

This will show you lines like these:

💻Code
UID  USER     PROC PWD-LOCK PWD-DENY LAST-LOGIN GECOS
0    root     205        0        1             root
1000 richard  80                    09:41       Richard

Get User IDs using the getent command

The `getent` command in Ubuntu helps you retrieve the user ID for a single specific person by checking the system’s user details, particularly the information in the `/etc/passwd` file. To find a specific user’s ID, run `getent passwd `, replacing `` with the person’s actual login name.

💻Code
getent passwd <username>
📝Good to Know
This command finds UIDs by looking at the information in /etc/passwd.
📝Good to Know
For example, if you want to know the UID of the user named geekrewind, you will run the command below.
💻Code
getent passwd geekrewind

You should get a single line with the user’s UID. The third column displays the UID of the user.

💻Code
richard:x:1000:1000:Richard,,,:/home/richard:/bin/bash

There could be other ways to get a user ID or UID that are not listed above. However, the steps provided should be a good starting point.

Conclusion:

  • Understanding the concept of User ID or UID and its importance in Ubuntu Linux
  • Learning multiple methods to retrieve User IDs for individual users and all users on the system
  • Exploring commands like id, lslogins, and getent to obtain user IDs efficiently
  • Enhancing user management and tracking capabilities on Ubuntu Linux through UID retrieval
  • Encouraging further exploration and utilization of additional methods for obtaining user IDs or UIDs in Ubuntu Linux

Where is the user ID stored in Linux?

UID (User Identifier) in Linux is a unique numerical value assigned to each user account, helping identify and differentiate users. The UID is stored in the system’s user database, usually in the /etc/passwd file, along with other user details.

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard, a writer for Geek Rewind, is a tech enthusiast who loves breaking down complex IT topics into simple, easy-to-understand ideas. With years of hands-on experience in system administration and enterprise IT operations, he’s developed a knack for offering practical tips and solutions. Richard aims to make technology more accessible and actionable. He's deeply committed to the Geek Rewind community, always ready to answer questions and engage in discussions.

📚 Related Tutorials

How to List User Profiles and Accounts in Windows 11
Windows How to List User Profiles and Accounts in Windows 11
How to Install GNOME Desktop on Ubuntu 24.04
Ubuntu Linux How to Install GNOME Desktop on Ubuntu 24.04
How to Install KDE Desktop on Ubuntu 24.04
Ubuntu Linux How to Install KDE Desktop on Ubuntu 24.04

No comments yet — be the first to share your thoughts!

Leave a Comment

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