Tag Archives: linux

Command-line stopwatch

Back when I only had 1 iOS device I was wanting to calculate how fast voiceover was reading to me, but the only stopwatch I had was on my iPhone; I had a problem to solve. I probably could have found a GUI program that had a stopwatch as a function but I just wanted something really simple, and the command-line is my friend.

 

I knew about a timer command in 4DOS and Take Command 32 made by JP Soft  that I liked to use back in the day, and after some googling found unix linux and OS X had a similar time command, then I wondered how I could suspend the terminal session so time would be timing the pause, cat with no input was the answer.

time cat
and press enter.  The stopwatch will start, but you won’t get any ,  feedback, not even a prompt, but it will keep track for you intel control-c is pressed. Then you will get the timed result.  .

real 0m4.457s
user 0m0.002s
sys 0m0.004s

The top line beginning real is the elapsed time, that’s what you want.

The second line is , the time consumed by system overhead,

and the third line tells the time used to execute utility to the standard error stream. rarely will lines 2 and 3 matter but at least they’re there if you ever need them.

Advertisements