Skip to content

Simple timer

by Stephen Mann on December 17th, 2009

While working on my Rubik’s cube, I came up with a simple timer for your average unix-like system. Try putting the following in your ~/.bashrc:

alias timer="echo 'begin timer';time sleep 1d"

Then source it (. ~/.bashrc) and enter timer to run it. It prints a start message, starts the time command-line utility, and then waits (sleeps 1 day). Hit ctrl-c to stop, and it prints the elapsed time. Dead simple, but effective enough.

For those wanting an even more simple solution, just type time sleep 1d into the command-line.

For those wanting more, I’d recommend creating a bash function that takes a message, so you can comment on what the timer’s timing.

From → tech

No comments yet

Leave a Reply

Note: XHTML is allowed. Your email address will never be published.

Subscribe to this comment feed via RSS