跟踪命令在 UNIX/LINUX 中花费的时间?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/12096966/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-06 14:09:16 来源:igfitidea点击:
Track the time a command takes in UNIX/LINUX?
提问by OneChillDude
In UNIX/LINUX, is there an easy way to track the time a command takes?
在 UNIX/LINUX 中,是否有一种简单的方法来跟踪命令所花费的时间?
采纳答案by squiguy
回答by Paolinux
Use
用
/usr/bin/time
instead that the time builtin in the bash: it is more configurable AFAIK.
取而代之的是 bash 中内置的时间:它更易于配置 AFAIK。
e.g. /usr/bin/time --format=' \n---- \nelapsed time is %e'ls
回答by Guillaume Chevalier
Here is how a sleep
of one second looks like, timed with time
:
以下是sleep
一秒的样子,时间为time
:
$ time sleep 1
real 0m1.001s
user 0m0.000s
sys 0m0.000s