# Identifying a Process's Cgroup by PID Read `/proc//cgroup` to find which cgroup (and therefore which container) a process belongs to. ## /proc/PID/cgroup ```bash cat /proc//cgroup ``` Shows all cgroup controllers the process belongs to: ``` 12:blkio:/user.slice 11:memory:/user.slice/user-1000.slice ... 0::/user.slice/user-1000.slice/session-1.scope ``` On cgroup v2, the path after `::` is the cgroup path under `/sys/fs/cgroup/`. ## Other Methods ```bash # ps format options ps -o pid,cgroup -p # systemd systems systemd-cgls --unit systemd-cgls # whole tree ``` ## Quick One-Liners ```bash cat /proc/self/cgroup # current shell cat /proc/$$/cgroup # also current shell cat /proc/1234/cgroup # specific PID ```