To resolve a cgroups issue where a process is being placed in the wrong cgroup, I'm being advised to take regular snapshots of the /proc/process-id/cgroups files over a period of time when the process is running. The idea being to identify the process and check if it's allocated cgroup is correct and/or changes over time.

Does anyone know of any tools which can capture this kind of information? I'm aware that simply 'tar'ing /proc isn't an option due to its nature.


Even if it's virtual, it's just a text file:

grep . /proc/[0-9]*/cgroup | sort -V > snapshot.txt

This won't include process names (only PIDs) but that might be enough if you're trying to watch a long-running process, and it would be easy enough to get the command from /proc/…/exe or /proc/…/cmdline. You could possibly even 'tar' /proc if you carefully specified what to include.

Alternatively, if you want a tree output (with process names and everything):


(Best on cgroup v2 systems. On cgroup v1, systemd-cgls only captures 'name=systemd', not the other controllers.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.