Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've been trying to find a decent way to monitor elapsed time in the shell. Basically, I'm asking for a stopwatch. The end result is easy enough to accomplish; I've seen examples of using time read, and then hitting enter when you're done, but that method makes the current terminal unusable.

Ideally, I'd like something like:

timer start
(do some work, vim, python, etc.)
timer stop

It also would be nice if there was a way to pause the timer. For reference, I was planning on using it to time how long it takes to finish programming assignments from MIT's OCW. As such, since the assignments might be completed in more than one sitting, a way to pause and continue the timer would be beneficial.

Is there anything like this?

share|improve this question
up vote 3 down vote accepted

You may try a shell script (call it timer.sh) like this:

. timer.val

case "$1" in 
   echo "TIMERSTART=`date +%s`" > timer.val
   TIMEREND=`date +%s`
   echo $TIMEREND
   echo $RESULT
   echo "no command"
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.