开发者

linux show process duration

开发者 https://www.devze.com 2023-02-11 10:38 出处:网络
how do I show how long it takes to run a command on linux? eg gunzip large.gz and I want 开发者_开发百科to show how long it took.In bash, $ time gunzip large.gz will tell you how long $ gunzip lar

how do I show how long it takes to run a command on linux? eg

gunzip large.gz

and I want 开发者_开发百科to show how long it took.


In bash, $ time gunzip large.gz will tell you how long $ gunzip large.gz takes.

You can also watch the process while it's executing using top or ps.


Although one can always use $ time (command), I prefer using the method which would spit out the time even when the process is running. To do that, there is one simple way:

$ ps -p ?? -o etime

Where ?? is the pid of the running process. This will give the exact time elapsed since the start of the process.

0

精彩评论

暂无评论...
验证码 换一张
取 消