Quick and Dirty Stopwatch via the Mac Terminal

Sep 12, 2009 - 1 Comment

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
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.

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:

Related articles:

Posted by: Bill Ellis in Command Line, Tips & Tricks

One Comment

» Comments RSS Feed

  1. […] If you’re not keen on installing third party apps, you can always create a rudimentary stopwatch from the command line […]

Leave a Reply


Shop for Apple & Mac Deals on Amazon.com

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Recent Posts