![命令提示符的秒表?](https://linux22.com/image/1115587/%E5%91%BD%E4%BB%A4%E6%8F%90%E7%A4%BA%E7%AC%A6%E7%9A%84%E7%A7%92%E8%A1%A8%EF%BC%9F.png)
是否有秒表,以便我可以测量 BASH shell 执行不同命令所花费的时间?
答案1
time [command]
返回命令完成所需的时间。
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:~$