How to get ps to print group?

user782220 picture user782220 · Nov 27, 2013 · Viewed 23.1k times · Source

ps aux will print out something formatted according to the below. It shows the user that the process runs under. But is there a way to display the group that the process runs under?

USER       PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND

Answer

devnull picture devnull · Nov 27, 2013

You can specify the desired format:

   o format
          Specify user-defined format.  Identical to -o and --format.

For example, saying:

ps o pid,group

would print pid and group.

Saying:

ps o pid,group,gid

would print pid, group and group ID.


As per your comment, the following might work for you:

ps o user,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,comm,group,gid

To see all processes:

ps ax o user,pid,%cpu,%mem,vsz,rss,tty,stat,start,time,comm,group,gid