Know Who’s Who Are Logging And What The User Is Doing

If you are a system administrator or sysadmin of a Linux computer, where multiple users can log in simultaneously, you may be wondering how we can find out who I am currently logged in and what your users are doing using w command.

[lica @ canada ~] # w
11:18:03 up 3 days, 23:31, 1 user, load average: 1.22, 1.20, 1.05
USER TTY FROM LOGIN @ IDLE JCPU PCPU WHAT
lica pts / 1 gw.kurungsiku 11:05 0.00s 0.01s 0.00s w
From the above info we can see there is 1 user with:

  • username lica
  • login from pseudo terminal pts / 1
  • from my gw.kurungs
  • logged in at 11:05
  • idle for 0.05s
  • JCPU 0.01s, is the amount of time used by all processes related to the tty used by the user, but excludes previous background jobs and only includes the currently running background jobs
  • The PCPU0.00s time used by the current process is written in the WHAT column
  • The last/last command is executed w

Knowing How Long a Computer Has Been On With Uptime

If you want to know how long a computer with a Linux operating system has turned on, you can read the file / proc / uptime, or for easy you can use uptime commands. as an example

$ uptime

11:05:23 up 3 days, 23:18, 1 user, load average: 1.01, 1.11, 1.01
The output of the above uptime command gives us the following info

Current time (11:05:23)
How long the system has been on (3 days, 23:18)
Number of current user login (1 user)
Average system load (Load Averages) for last 1, 5 and 15 minutes
Maybe useful!