Sometimes you want to know how much CPU time has been used by a given process – let’s say the named-daemon…
Of course you can use top , but usually you would have to add columns, sort/filter by user or command name, etc…
You can simply use:
ps -A -o pid,comm,cputime | grep named
This will give you all processes that contain named in their command name(in my case one single named-process was running), showing their pid, command name, and cumulative cpu time, like:
20129 named 05:27:11