LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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
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
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



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 01:21 PM
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
System will automatically close my x server after a certain idle time. ICO Slackware 1 02-16-2004 11:26 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration