How to see all users created on Linux

To see all users in Linux, you can check the contents of the /etc/passwd file โ€” this file stores information about all user accounts.

๐Ÿงพ Show All Users

cat /etc/passwd

This will show a list of all users in this format:

username:x:UID:GID:comment:home_directory:shell

If you want just the usernames, run:

cut -d: -f1 /etc/passwd

๐Ÿ‘ฅ To Show Only Human Users (not system users)

Most human users have a UID โ‰ฅ 1000 (except for root which is UID 0). You can filter like this:

awk -F: '$3 >= 1000 && $3 != 65534 { print $1 }' /etc/passwd

65534 is typically the nobody user.


๐Ÿ” To See Logged-In or Recently Active Users

  • Current users logged in:
    who
    
  • Show login history:
    last
    

 

Leave a Comment

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top