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

(adsbygoogle = window.adsbygoogle || []).push({});

Posted by: SXI ADMIN

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 your Bitcoin Exchange with our Software

Start your Bitcoin Exchange with our Software Setup your white label bitcoin exchange right away. Or create your own cryptocurrency using...

How to KVM, QEMU start or stop virtual machine from command line (CLI)

KVM or Kernel Based Virtual Machine is a popular virtualization technology. It allows you to run virtual guest machines over a host machine. To start...

How to Docker backup Saving and restoring your volumes

Running a Docker volume backup First, we spin up a temporary container, and we mount the backup folder and the target Docker volume to this container....