Is there a stopwatch, so that I can measure time taken for different commands for BASH shell?
Asked
Active
Viewed 2,490 times
1 Answers
10
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
steven@wind:~$

Steven K
- 4,536
TIMEFORMAT=%R; time sleep 5
would output just the real time in seconds;5.003
. And if you want to capture time's output, http://mywiki.wooledge.org/BashFAQ/032 explains how. – geirha Jun 20 '13 at 18:57