« Back to Processes: Frequently Asked Questions

How to see cgroup in ps output

The ps command can show the control group of a process using the -o option, followed by the right column names.

Usage

To show processes and the control group, we can filter the output columns.

# ps -e -o pid,cgroup:64,args
    PID CGROUP                                                           COMMAND
      1 0::/init.scope                                                   /lib/systemd/systemd --system --deserialize 58
      2 -                                                                [kthreadd]
      3 -                                                                [rcu_gp]
<snip>
    576 -                                                                [xprtiod]
    634 0::/system.slice/dbus.service                                    @dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
    640 0::/system.slice/networkd-dispatcher.service                     /usr/bin/python3 /usr/bin/networkd-dispatcher --run-startup-triggers
    645 -                                                                [nfsiod]
    653 0::/system.slice/systemd-logind.service                          /lib/systemd/systemd-logind
    696 0::/system.slice/system-getty.slice/getty@tty1.service           /sbin/agetty -o -p -- \u --noclear tty1 linux

In this example the PID is displayed, with the control group, and the command with its arguments. By specifying the width of 64 characters, we can properly see the full name of the control group.

Other questions related to Processes

Feedback

Is the described answer not working or incorrect, got another tip or question? Share your thoughts!