Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to get CPU usage of a process by,

ps -p 12990 -o comm=comm,pcpu

But that only print the command name (the process does exist), what's wrong with it?

share|improve this question
up vote 4 down vote accepted
ps -p 12990 -o comm,pcpu

will show the %CPU and COMMAND columns for the process with PID 12990.

-o comm=comm,pcpu is being interpreted by your ps as "output the comm column, but rename the header comm,pcpu".*

If you explicitly want the comm header to be "comm", you'll either need to use two -o flags:

ps -p 12990 -o comm=comm -o pcpu

or put the renamed comm column at the end of the -o argument

ps -p 12990 -o pcpu,comm=comm

*From the ps(1) man page:

The behavior of ps -o pid=X,comm=Y varies with personality; output may be one column named "X,comm=Y" or two columns named "X" and "Y". Use multiple -o options when in doubt.

share|improve this answer
This is the behavior specified by POSIX: “The default header can be overridden by appending an equals sign and the new text of the header. The rest of the characters in the argument shall be used as the header text.” – Gilles Mar 8 '13 at 0:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.