Oleksandr Husiev
Oleksandr Husiev

Reputation: 152

Extracting time of a work of a process in Unix

Is there any commands/parameters, which allow me to know for how long the process has been working? I tried to search something in commands ps and top , but didn't find it.

Upvotes: 0

Views: 34

Answers (1)

JB.
JB.

Reputation: 42094

For a process whose time you want to (or accept to) collect after it ends, simply use the time command. It's available as an independent command and usually as a shell builtin as well.

$ time sleep 5
real    0m5.028s
user    0m0.000s
sys     0m0.000s

For a process that's still running, have a look at ps's formatting options.

$ ps -o time,etime 1

Exact option name might vary with the system, be sure to check your ps manual.

Upvotes: 1

Related Questions