Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

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

In bash shell, is there a simple way for me to monitor the time taken to run a script and output the time taken?

share|improve this question
up vote 32 down vote accepted

Yes.

 time script

Where script is the script to monitor the time for.

For instance, time find ~ will output something like this (Depending on the size of your home directory, that is):

real    0m49.139s
user    0m0.663s
sys     0m4.129s
share|improve this answer
    
that is so awesome. Thanks Mr Man! – Jason Jan 4 '11 at 3:40
    
@Jason: You're welcome! I'm glad that this helped! – Wuffers Jan 4 '11 at 13:17
    
thanks a lot my friend. – simplyharsh Mar 28 '12 at 12:18

I made a tic/toc timer pair utility called ttic and ttoc. It's available here.

Example use:

$ ttic && sleep 0.4 && ttoc
0.405

To avoid conflicts with an existing tic/toc pairing, an ID can be specified, here foo:

$ ttic foo && sleep 0.5 && ttoc foo

Or assign a random ID, like so:

$ id=$(ttic --unique) && sleep 0.5 && ttoc $id
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .