Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Is there a stopwatch, so that I can measure time taken for different commands for BASH shell?

share|improve this question

1 Answer 1

time [command] returns the time taken for the command to complete.

steven@wind:~$ time du /storage -s
du: cannot read directory `/storage/lost+found': Permission denied
1548584024      /storage

real    0m4.046s
user    0m0.224s
sys     0m1.496s
steven@wind:~$ time sleep 5

real    0m5.003s
user    0m0.000s
sys     0m0.000s
share|improve this answer
Might be worth adding that (in bash,) time's output can be modified with the TIMEFORMAT variable. E.g. with the last example, TIMEFORMAT=%R; time sleep 5 would output just the real time in seconds; 5.003. And if you want to capture time's output, explains how. – geirha Jun 20 '13 at 18:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.