« Back to Processes: Frequently Asked Questions

How to see the cgroup of a process

How to see the cgroup of a process?

Look in the 'cgroup' file within the /proc directory and the related process ID.

cat /proc/PID/cgroup

The control group of a process can be retrieved from the /proc directory. We only need to know the PID of the process, which can be found using ps or pidof.

Usage

If we know that our PID is 1234, then showing the cgroup is as easy as using cat to see the contents of the ‘cgroup’ file.

cat /proc/1234/cgroup

To see the cgroup for the nginx process (or one of them), we could something like this.

cat /proc/$(pidof -s nginx)/cgroup

Want to see the value directly from the process listing?

Relevant FAQ: How to see cgroup in ps output?

Relevant commands in this article

Like to learn more about the commands that were used in this article? Have a look, for some there is also a cheat sheet available.

  • cat
  • pidof
  • ps

Other questions related to Processes

    Related articles

    Like to learn more? Here is a list of articles within the same category or having similar tags.

    Feedback

    Small picture of Michael Boelen

    This article has been written by our Linux security expert Michael Boelen. With focus on creating high-quality articles and relevant examples, he wants to improve the field of Linux security. No more web full of copy-pasted blog posts.

    Discovered outdated information or have a question? Share your thoughts. Thanks for your contribution!

    Mastodon icon