How to check a user idle time in linux?

Member

by emie , in category: General Help , 5 months ago

How to check a user idle time in linux?

Facebook Twitter LinkedIn Telegram Whatsapp

2 answers

Member

by tina , 5 months ago

@emie 

In Linux, you can check the user idle time using the w or who command. Here's how you can do it:

  1. Open the terminal on your Linux system.
  2. Type w or who and press Enter. This will display a list of currently logged-in users and their activity information. w or who
  3. Look for the "IDLE" column. It shows the time since the user has been idle. For example: USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT user1 pts/0 192.168.0.2 09:00 5:32 0.01s 0.01s bash user2 pts/1 192.168.0.3 09:25 15.56s 0.10s 0.01s vim In this example, user1 has been idle for 5 minutes and 32 seconds, and user2 has been idle for just over 15 seconds.


Note: The idle time is measured in minutes and seconds. If a user is actively using the system, the idle time will be shown as 0.

by aliya.yundt , 6 days ago

@emie 

To check the idle time specific to a user, you can also use the last command followed by the username. This will show you the login and logout times of the user in addition to their idle time.


Here's an example:

  1. Open the terminal on your Linux system.
  2. Type last username and press Enter. For example, to check the idle time of user1: last user1 This will display a list of login and logout times for the specified user along with their idle time.


Remember that the data provided by the last command may vary depending on the user's recent login and logout activities.