In Linux, you can check the user idle time using the
who command. Here's how you can do it:
- Open the terminal on your Linux system.
- Type w or who and press Enter. This will display a list of currently logged-in users and their activity information.
- Look for the "IDLE" column. It shows the time since the user has been idle.
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.