Find Currently Logged In Users In Linux

Find Currently Logged In Users In Linux

Linux is a multi-user operating system that allows multiple users to connect to the system at the same time and access system resources. Sometimes we may need to find currently logged in users. This tutorial shows how to do that in Linux.

Linux provides w command that allows to find currently logged in users and activity of them.

w

Output example:

02:14:23 up 42 min,  3 users,  load average: 1.15, 0.44, 0.16
USER     TTY      FROM             LOGIN@   IDLE   JCPU   PCPU WHAT
john     pts/0    192.168.0.2      02:02   11:29   0.02s  0.02s bash --login
adminer  pts/1    192.168.0.2      02:01    1.00s  0.03s  0.00s w
james    pts/2    192.168.0.2      02:04   10:16   0.02s  0.02s bash --login

The w command displays the following information of each logged in user:

  • USER - login name.
  • TTY - terminal name.
  • FROM - remote IP address or hostname.
  • LOGIN@ - login time in a 24-hour format.
  • IDLE - the time when the user last used the terminal.
  • JCPU - the total time used by all system processes which attached to the user's terminal.
  • PCPU - the time used by the user's current process.
  • WHAT - the name of user's current process.

Leave a Comment

Cancel reply

Your email address will not be published.