How to show current logged in users in Linux

You can use the w command to show the current logged-in users on a Linux system:

 
$ w

This command will show the following information for each user:

  • USER: the username of the user.
  • TTY: the terminal associated with the user.
  • FROM: the hostname or IP address from which the user logged in.
  • LOGIN@: the time when the user logged in.
  • IDLE: the time the user has been idle.
  • JCPU: the time used by all processes attached to the terminal.
  • PCPU: the time used by the current process attached to the terminal.
  • WHAT: the command being executed by the user.

You can also use the who command to show the current logged-in users:

 
$ who

This command will show the following information for each user:

  • NAME: the username of the user.
  • LINE: the terminal associated with the user.
  • TIME: the time when the user logged in.
  • IDLE: the time the user has been idle (if supported by the terminal).
  • HOST: the hostname or IP address from which the user logged in (if supported by the terminal).

Leave a Comment