LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices

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

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


Hi!

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?

regards,
vasanth.
 
Old 04-05-2010, 06:08 AM   #2
b0uncer
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
Code:
w
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 06:10 AM.
 
Old 08-15-2013, 04:29 PM   #3
rjwilmsi
Member
 
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 http://crunchbang.org/forums/viewtopic.php?id=26447 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
 
  


Reply

Tags
system


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
Find X idle time jlinkels Linux - Software 4 08-16-2013 03:19 PM
Idle time vs program time kinkle Linux - General 4 03-11-2009 09:57 PM
finding login time and idle time,..etc from a list of users knavramesh Linux - Newbie 2 10-02-2008 10:55 PM
Idle Time in KDE elconde Linux - Software 2 05-19-2006 06:12 AM
System will automatically close my x server after a certain idle time. ICO Slackware 1 02-16-2004 11:26 AM


All times are GMT -5. The time now is 01:59 AM.

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