Quick and Dirty Stopwatch via the Mac Terminal

You can create an instant quick and dirty stopwatch via the Mac OS X (or linux) command line by launching the Terminal app and typing the following command string:

time cat

Now hit enter and the stopwatch begins.
At any point, you can stop the counting stopwatch by hitting Control-C on the keyboard, which will return to the command prompt while returning something back that looks like this:

$ time cat
^C
real 0m5.905s
user 0m0.001s
sys 0m0.003s

The top ‘real’ number is the elapsed time, that is, time that passed since executing the command.

How this stopwatch works is that you are using the ‘time’ command to measure the time of how long another command takes to execute, but since the cat command requires something to output and we are not providing anything, cat does nothing, thus creating a simple stopwatch. Great little trick, huh?

This works in Mac OS X, Linux, and should work in just about any other version of unix that supports the time and cat commands.

Related

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of our great Apple tips, tricks, and important news delivered to your inbox! Enter your email address below: