linux show process duration
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.
精彩评论