I need to find the idle time on a machine in the manner: How long time ago somebody did the last action with mouse or keyboard? Unfortunately "w" doesn't do this. It produced the following output on a machine a user was actually working on with an application:
15# w
15:55:28 up 15 days, 8:27, 6 users, load average: 0.08, 0.12, 0.09
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
gas pts/1 - 07:24 8:30m 0.00s 0.37s kdeinit: kded
gas pts/2 - 07:24 2:01m 0.10s 0.10s -bin/tcsh
gas pts/3 - 07:24 8:30m 0.06s 0.06s -bin/tcsh
gas pts/4 - 07:24 37:43 1:24 0.09s -bin/tcsh
gas pts/5 - 07:24 5:16m 0.09s 0.09s -bin/tcsh
root pts/7 nodep954 15:46 0.00s 0.02s 0.00s w
The lowest idle time on /dev/pts/4 is 37:43 mins! Background is to find out if the user is busy on the machine or walked away for a meeting for a while.