Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - General
User Name
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.


  Search this Thread
Old 07-24-2012, 04:23 AM   #1
LQ Newbie
Registered: Jul 2012
Posts: 2

Rep: Reputation: Disabled
Smile automatically run command in terminal after x minutes of idle time.

Hi, I'd like to know if there is any way to automatically run a specific command in the terminal after the terminal has been idle for x minutes. I use terminator, so I have several terminal windows open at the same time. What I want to do is to make my terminal run a command when the idle time reaches x minutes. The command I want to run is:
> cmatrix -b

It's just a fun command that I want to use as a terminal screen saver.
I think I want something like this in my .bashrc file:

> if (terminal.idle.time = 5 min) {
> cmatrix -b
> } else {
> do nothing}

Is it possible?

Thanks a lot.

Last edited by williantalvane; 07-24-2012 at 04:25 AM.
Old 07-25-2012, 06:31 PM   #2
Registered: Aug 2004
Location: UK
Distribution: Gentoo, OpenBSD, Debian, FreeBSD, RHEL, CentOS
Posts: 65

Rep: Reputation: 24
Two options come to mind:
  1. xidle
  2. xautolock

I presume you're using Ubuntu, from your post icon.

The first I've used in the past (maybe on BSD) but can't find this in standard repos for Linux (well Debian & Ubuntu).
By the look of it the second could be fashioned to use with --time and specifying a script to --notifier or --locker.
Old 02-20-2013, 12:42 PM   #3
LQ Newbie
Registered: Jul 2012
Posts: 2

Original Poster
Rep: Reputation: Disabled
I still don't know how to do that. Could you explain me how xautolock would do that? What I want is very simple. I want to script that says:
If terminal idle time reaches 5 min, the terminal will execute the following command: cmatrix -b
There must be some way to do this simple task.
Old 02-21-2013, 11:21 PM   #4
Registered: Dec 2012
Posts: 52

Rep: Reputation: 7
The most simplest way to execute a command after a certain time period is with sleep

sleep 5m ; cmatrix -b


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 On
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How do i run a command every day at a certain time automatically? Squerl101 Linux - Server 6 11-04-2011 05:39 AM
How can Fedora run automatically a Terminal command at the startup? cesar7160 Fedora 4 05-19-2009 11:54 AM
Automatically Disconnecting Users After Five Minutes Idle Time kaplan71 Linux - Server 3 05-21-2008 10:13 PM
System will automatically close my x server after a certain idle time. ICO Slackware 1 02-16-2004 11:26 AM
start terminal & run command automatically peeples Linux - General 2 09-08-2003 02:57 PM > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 12:38 AM.

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