user782220
user782220

Reputation: 11187

How to get ps to print group?

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

Upvotes: 29

Views: 40904

Answers (3)

Walf
Walf

Reputation: 9318

This gives similar output to ps -ef but adds the effective group name.

ps -eO user,group,ppid,c,start_time

(That flag is a capital O.)

Upvotes: 2

Vitalis
Vitalis

Reputation: 434

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

To print the full command e.g python script.py --env LOCAL

Upvotes: 1

devnull
devnull

Reputation: 123538

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

Upvotes: 41

Related Questions