Track the time a command takes in UNIX/LINUX?

2020-02-17 04:15发布

In UNIX/LINUX, is there an easy way to track the time a command takes?

3条回答
混吃等死
2楼-- · 2020-02-17 04:47

Yes, use time <command>, such as

time ls

Consult man time for more options. Link.

查看更多
SAY GOODBYE
3楼-- · 2020-02-17 04:53

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
查看更多
一夜七次
4楼-- · 2020-02-17 04:58

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
查看更多
登录 后发表回答