Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 04-05-2010, 06:04 AM   #1
LQ Newbie
Registered: Apr 2010
Location: India
Distribution: Fedora
Posts: 1

Rep: Reputation: 0
How do I get the system idle time ?


I want to get the system idle time till a mouse move or a key press. How is it possible to get it from a char terminal running through ssh/telnet as well as a from an X-terminal session?

Old 04-05-2010, 07:08 AM   #2
LQ Guru
Registered: Aug 2003
Distribution: CentOS, OS X
Posts: 5,131

Rep: Reputation: Disabled
Depends on what you mean by "idle time" exactly, but for a start, run
and check out the column named "idle". Not sure what you mean by "X-terminal session", but you can run this from a shell or terminal emulator within X..

Remember that if you check the idle time of the user you're checking it as, you'll reset the counter too (because you're typing and/or moving mouse when doing it).

EDIT: the above means of course the idle time of some user(s), not the "system" idle time. I'd say that's the best idle time you can get, because the system itself is hardly ever truly idle, except for when it's shut down; there are always some processes going on.

Last edited by b0uncer; 04-05-2010 at 07:10 AM.
Old 08-15-2013, 05:29 PM   #3
Registered: Mar 2005
Location: UK
Distribution: opensuse 12.2 x86_64
Posts: 563

Rep: Reputation: 38
Adding a note to an old thread in case this is of use to anybody else:

This post at crunchbang details a bash script to determine the time in seconds since the last mouse or keyboard action in the system. It doesn't depend on any X session or user being logged in since it's just looking at hardware interrupts. So for keyword searches: bash script for user idle / inactive time to suspend or lock



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Idle Time in KDE elconde Linux - Software 3 11-18-2015 02:21 PM
Find X idle time jlinkels Linux - Software 4 08-16-2013 04:19 PM
Idle time vs program time kinkle Linux - General 4 03-11-2009 10:57 PM
finding login time and idle time,..etc from a list of users knavramesh Linux - Newbie 2 10-02-2008 11:55 PM
System will automatically close my x server after a certain idle time. ICO Slackware 1 02-16-2004 12:26 PM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:55 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration