Shell Script – Set a timer

October 2016


I would like set a timer in shell.

In fact, I would like to get a message to warn me by “echo” from my terminal at a certain hour of a day.
Have you an idea of the script I should use?


You must type the command directly into the terminal, as follows:

[tmpfs] now at $ 1 minutes <ENTER>
warning: commands will be executed using (in order) a) $ SHELL b) login shell c) /bin/sh
at> echo "Hello"> /dev/pts/2 <ENTER>
at> <EOT> <Ctrl+D>
job 22 at 2010-01-29 15:00
[tmpfs] $

You first enter the command followed by the date on which it is supposed to be done, and you validate by <ENTER>.

At the prompt (at>) you enter the command to be executed and where it must eventually be executed/displayed (in your case the terminal) and bodied by <ENTER>.

To finish and exit, <Ctrl+D> type (the <EOT> should not be typed, it is the result of the combination of CTRL + D).


Thanks to jipicy for this tip on the forum.

Related :

This document entitled « Shell Script – Set a timer » from CCM ( is made available under the Creative Commons license. You can copy, modify copies of this page, under the conditions stipulated by the license, as this note appears clearly.