Which command helps you to see the users who are logged in? Learn how to check user login history in Linux. Here is how to check user activity log in Linux and active user sessions in Linux.
How To Check User Is Active Or Not In Linux
W Command: w command used to show who is logged on and what they are doing. w displays information about the users currently on the machine, and their processes. The header shows, in this order, the current time, how long the system has been running, how many users are currently logged on, and the system load averages for the past 1, 5, and 15 minutes.
The following entries are displayed for each user:
- login name
- the tty name
- the remote host
- login time
- idle time
- JCPU & PCPU
- command line of their current process
Who Command: ‘who’ prints information about users who are currently logged on. When no non-option argument is given with the command, ‘who’ prints the following information for each user currently logged on:
- login name
- terminal line
- login time
- remote hostname or X display
If you want to see the date and time of last system boot, run the who command with ‘–boot’ argument.
When you execute who command with ‘-q’ or ‘–count’ argument it will show only the login names and the number of users logged on. It will override all other options.
When you execute who command with ‘-u’ it will show the idle time. After the login time, print the number of hours and minutes that the user has been idle. ‘.’ means the user was active in the last minute. ‘old’ means the user has been idle for more than 24 hours.