Friday, 1 April 2011

How to use your Linux Terminal as a stop watch timer?

Some times we may need to use a stop watch timer in order to calculate the time taken by something against some other thing to compare between two things. For example, if you need to check the speed of loading pages between Firefox 4 and Google chrome in linux.

As you are using linux, there is always a simple and better way to do this. For doing this you do not have to install a separate software. You can use your terminal as a stop watch timer. Yes, you have heard it right. I repeat " You can use your terminal as a stop watch timer". Let's have a look at how to use the terminal as stop watch timer.


For doing this, open your terminal. Then type the below command to the terminal. Don't be afraid. It is a very small command and it is very easy to remember.

  •  time cat
Then press Enter. Now your terminal "stop watch timer" has started. Once your required task is over, we can stop the timer. Then we will see the time we have spent on that particular task.

In order to stop the timer:

  • press Ctrl+D
This will stop your timer and you can see the time you have taken for a particular task. See below images to get a better idea.




You can see that the "real" entry in the terminal shows 3m6.840s. This is the time you have taken for a particular task. Here in my case I have taken 3 minutes 6 seconds and 840 micro seconds. 
Cool... isn't it? This will come in handy if you just want to know the time you are going to take for a particular task in linux.
 

1 comment:

  1. That's pretty cool! And so beautifully simple and elegant.
    I like your blog and want to get updates about new posts in my email, but could not find a Follow button anywhere. Could you help?

    ReplyDelete