How to show current logged in users in Linux

last updated in Categories , , , , ,

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:
Linux see who is logged on and what they are doing command
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:

Linux Find Out The Current User Using whoami 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
Linux print information about current users who are currently logged in


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


Posted by: Vivek Gite

The author is the creator of nixCraft and a seasoned sysadmin, DevOps engineer, and a trainer for the Linux operating system/Unix shell scripting. Get the latest tutorials on SysAdmin, Linux/Unix and open source topics via RSS/XML feed or weekly email newsletter.

Start the discussion at

Historical Comment Archive

1 comment

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


    id command wasn’t that useful tho.

    Still, have a question? Get help on our forum!