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

Possible Duplicate:
Measure script execution time

How would I time how long it takes for my script to run?

I'm looking for something akin to tic and toc in MATLAB.

share|improve this question

marked as duplicate by Wuffers, studiohack Apr 4 '11 at 1:52

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

have you tried wrapping your code in time {} – n0pe Apr 4 '11 at 0:05
up vote 13 down vote accepted

Use the unix time command

time ./

If you're interested in ticks, you can approximate it with a little help from /proc/cpuinfo

share|improve this answer
time is a shell keyword – Hello71 Apr 25 '11 at 23:21
@Hello71 my linux bash does not provide a time command, it uses /usr/bin/time. However zsh does, as well as my solaris tcsh. So even if it's not builtin your shell, you have a time provided by your userland as a fallback. Besides, those time commands may provide a slightly different output. – mbx Apr 26 '11 at 9:45
@Hello71 although reserved, on that ystem which time returns userland time instead of the reserved keyword warning – mbx Apr 26 '11 at 21:20
@mbx: which never does that. I'm referring to type. – Hello71 Apr 26 '11 at 21:21

time can achieve this. In this case:

$ time             
share|improve this answer

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