In UNIX/LINUX, is there an easy way to track the time a command takes?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes, use time <command>
, such as
time ls
Consult man time
for more options. Link.
回答2:
Use
/usr/bin/time
instead that the time builtin in the bash: it is more configurable AFAIK.
e.g. /usr/bin/time --format=' \n---- \nelapsed time is %e'ls
回答3:
Here is how a sleep
of one second looks like, timed with time
:
$ time sleep 1
real 0m1.001s
user 0m0.000s
sys 0m0.000s