The ps -o flag

The ps command is well known for displaying process information, but it was only recently that I found out about the useful -o flag. What this flag does is display the information about one or more selected headers.

Let’s see an example where we display the rss (Resident Set Size) for the process with pid 5380:

$ ps -o rss -p 5380
   RSS
  1784

We can also display more headers separating them with commas:

$ ps -o rss,%cpu,%mem -p 348
   RSS  %CPU %MEM
179468   5.8  2.1

And we can also add a new label for a header:

$ ps -o rss=RealMemory -p 348
RealMemory
    179572