Skip to content
Follow
Ubuntu Linux

How to Retrieve User IDs in Ubuntu Linux

Richard
Written by
Richard
Jan 5, 2023 Updated Sep 15, 2026 2 min read
How to Use Sticky Notes in Windows 11
How to Use Sticky Notes in Windows 11

A User ID (UID) is a unique number that Ubuntu assigns to every account to control access to files and programs. Finding these numbers takes just a few seconds using the built-in Terminal app.

Advertisement

Run the id -u command to instantly check your own UID number, or type getent passwd to view a complete list of UIDs for every account set up on 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 `.

Advertisement

Get UID for Users on Ubuntu Linux

Ubuntu Linux assigns a User ID (UID) to keep track of each individual account.

Execute the `id` command shown below to find the current user ID.

💻Code
id

Output resembling this text appears on screen:

💻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 lets you retrieve user ID Ubuntu details for every account on your system at once. Running this tool in your terminal prints a complete list that pairs every username with its matching numeric identifier so you can check multiple user accounts quickly.

Advertisement

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

💻Code
lslogins -u

The terminal generates lines matching this format:

💻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 helps you find the user ID for a specific account on Ubuntu by checking the /etc/passwd file. This utility is the fastest way to look up the numeric identifier for one individual user instead of listing every account on the entire machine.

💻Code
getent passwd <username>

This command queries information located in /etc/passwd.

Advertisement

Querying the UID for an account named geekrewind requires running the command below.

💻Code
getent passwd geekrewind

A single line returns containing the user details, where the third column displays the UID.

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

Alternative methods exist for retrieving UIDs, but these commands provide a solid starting point for system administration.

Understanding User IDs in Ubuntu helps you manage system access and permissions effectively.

  • 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

Was this guide helpful?

Was this helpful?
Richard

About the Author

Richard

Tech Writer, IT Professional

Richard is a writer at Geek Rewind who turns complex IT tasks into clear, step-by-step guides. He draws on years of hands-on experience in system administration and enterprise IT operations, focusing on Windows, Linux and WordPress: the problems people actually run into, and the fixes that work. His server and WordPress guides come from systems he runs himself. Richard builds and maintains the platform behind Geek Rewind, from its Ubuntu servers and Nginx configuration to its custom WordPress plugins. Many new tutorials start with readers' questions, and he's always glad to answer them in the comments.

Advertisement

📚 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 *