14

Possible Duplicate:
Measure script execution time

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

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

dsg
  • 1,199

2 Answers2

24

Easiest way is to use bash's integrated time, GNU Time or another unix time command implementation:

time ./sript.sh

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

If you want to dig deeper, have a look at strace.

mbx
  • 794
5

time can achieve this. In this case:

$ time foo.sh             
J.K.
  • 246