Quickly find which processes live in which cgroup and verify resource containment. 31.12.2025 | reading time: 2 min Cgroups let Linux contain and account for processes; learning to inspect them helps diagnose resource issues and enforce limits. Quick hands-on Follow these commands on a system with cgroup v2 and systemd: they start a background sleep, show the process's cgroup, then list members of that cgroup. ```bash # start a background sleep and print its PID sleep 600 & echo $! 4242 # inspect that process's cgroup cat /proc/4242/cgroup 0::/user.slice/user-1000.slice/session-2.scope # list processes inside the cgroup cat /sys/fs/cgroup/user.slice/user-1000.slice/session-2.scope/cgroup.procs 4242 # show the command line of the PID found in the cgroup ps -o pid,cmd -p $(cat /sys/fs/cgroup/user.slice/user-1000.slice/session-2.scope/cgroup.procs) PID CMD 4242 sleep 600 ``` What to check next Look at controller-specific files inside the same cgroup directory such as `memory.current` or `cpu.max` on cgroup v2 to see usage and limits, compare `cgroup.procs` with `tasks` on legacy v1 systems, and check `/proc/<pid>/cgroup` to trace the unit or slice that placed the process; moving a PID into a new cgroup is possible by echoing the pid into `cgroup.procs` as root, or by launching with `systemd-run --scope` to create a transient scope. Inspecting with systemd and tools Use `systemd-cgls` to visualize the cgroup tree and `systemd-cgtop` to monitor top consumers, and combine those with standard process tools like `ps` or `top` to map high-level resource usage back to specific processes inside cgroups. Where to go next Practice these commands on a test host, then explore cgroup controllers and systemd integration to master resource management; for structured learning consider pursuing CompTIA Linux+ or LPIC-1 and intensive exam prep at bitsandbytes.academy to deepen Linux administration skills. Join Bits & Bytes Academy First class LINUX exam preparation. processes utilities troubleshooting