How to show current logged in users in Linux

I am a new Linux sysadmin user. How do I get a list of currently logged in users on Linux? How do I find out the user logged in using a terminal window on Linux?

Introduction You can use the following commands for user monitoring on Linux operating systems including to see a list of current logged in users on Linux:
  1. w command : Show who is logged on and what they are doing on Linux
  2. who command : Display information about Linux users who are currently logged in
  3. whoami command : Find out who you are currently logged in as on Linux
  4. id command : See user and group information for the specified USER account on Linux

All user names are stored in /etc/passwd file and can be displayed with help of cat command or grep command/egrep command:
cat /etc/passwd
grep '^userNameHere' /etc/passwd
grep '^tom' /etc/passwd

Let us see all examples and usage in details.

How to show current logged in users in Linux

Open the terminal window and type:

The w command shows information about the Linux users currently on the server, and their running processes. The first line displays, in this order:

  • The current time ( 22:11:17 )
  • How long the Linux server has been running (18 days)
  • How many users are currently logged on Linux (2 users)
  • The system load averages for the past 1, 5, and 15 minutes (1.01, 1.04, 1.05)

The following info displayed for each current logged in user:

sweta    pts/10   minitx           22:11    5.00s  0.04s  0.02s vim


  • sweta – Login name
  • pts/10 – The tty name
  • minitx – The remote host/desktop/laptop name
  • 22:11 – Login time
  • 5.00s – Idle time
  • 0.04s – JCPU (it the time used by all processes attached to the tty. It does not include past background jobs, but does include currently running background jobs.)
  • 0.02s – PCPU (it is the time used by the current process, named in the “what” field.)
  • vim – The command line of their current process

Find out who you are currently logged in as on Linux

Execute the following command:
Another option is to just type the following id command:

Use the whoami and id commands to find out who you are currently logged in as on Linux based system

Linux show who is logged on

Again run the who command:
who -a


This page showed how to find out current logged in users in Linux and what they are doing from the terminal. For more info see man pages using the man command:
man w
man who
man whoami

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 1 comment so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
1 comment… add one
  • Reshma Mar 26, 2018 @ 13:06

    Yes, I used all three to get what I needed from my SUSE server :)


    id command wasn’t that useful tho.

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum