Egg Timer
This page was last updated on July 20, 2009.
Method 1
This is a command line method for creating a timer using the sleep command. The system bell will sound once at the beginning and once at the end of the count.
- Open a terminal window and type this command, replacing NUMBER with the number of seconds you’d like the timer to run:
echo -e '\a' >&2; sleep NUMBER; echo -e '\a' >&2
- For example, you would use this command to set a timer for 30 seconds:
echo -e '\a' >&2; sleep 30; echo -e '\a' >&2
- For example, you would use this command to set a timer for 30 minutes:
echo -e '\a' >&2; sleep 30m; echo -e '\a' >&2
Method 2
This is a script that asks how long you’d like the timer to run, notifies you of each minute that passes and rings the system bell when the time is up.
- The script:
#!/bin/bash echo -n "How many minutes would you like the timer to run? " read limit echo echo "Timing $limit minutes..." echo counter=0 while [ $counter != $limit ]; do echo "$counter minutes so far..."; sleep 60 let "counter = $counter + 1" done if [ $counter = $limit ]; then echo echo "Time's up - $counter minutes have elapsed!" echo -e '\a' >&2 exit 0 fi
- Copy the above script.
- Paste it into a text editor.
- Save the file as timer.sh.
- Open a terminal window.
- Change to the directory the script is in.
- Type this command:
- Press the Enter key.
bash timer.sh
How many minutes would you like the timer to run? 3 Timing 3 minutes... 0 minutes so far... 1 minutes so far... 2 minutes so far... Time's up - 3 minutes have elapsed!
Obligatory Happy Ending
And they all lived happily ever after. The end.

[...] The shell script is actually a modified version of the one published here (http://mostlylinux.wordpress.com/commandline/eggtimer/). [...]
Pingback by Simple egg timer on Linux for Pomodoro technique « {love to code?} — December 19, 2010 @ 2:27 am