systemd-cgls
Show systemd control group tree
TLDR
Display the whole control group hierarchy on your system
Display a control group tree of a specific resource controller
Display the control group hierarchy of one or more systemd units
SYNOPSIS
systemd-cgls
[OPTIONS] [CGROUP...]
PARAMETERS
-h
, --help
Prints a short help text to the console and exits.--version
Prints a short version string of systemd-cgls
and exits.-a
, --all
Shows all control groups, including empty ones. By default, empty cgroups are not displayed in the output.-M
, --machine=
CONTAINER
Operates on a local container. The specified CONTAINER is the name of a machinectl
container where the cgroup hierarchy should be inspected.-l
, --full
Do not abbreviate unit names or cgroup paths in the output. By default, long names might be truncated for better readability.--unit=
UNIT
Shows only processes that are part of the specified systemd UNIT (e.g., apache2.service
) and its cgroup path.--root
Starts displaying the cgroup tree from the root of the cgroup hierarchy, even if systemd is not managing the entire root. This provides a complete view of all cgroups on the system.
DESCRIPTION
systemd-cgls
is a command-line utility that recursively lists the contents of the Linux control groups (cgroups) managed by systemd. It provides a tree-like view of the hierarchy, showing which processes belong to which cgroup. Cgroups are a Linux kernel feature that allows for the organization of processes into hierarchical groups for the purpose of resource management, such as CPU, memory, and I/O. systemd
extensively uses cgroups to manage resources for services, scopes, and slices. This command helps administrators understand the resource isolation and allocation applied by systemd, troubleshoot resource issues, and identify processes within specific systemd units or other cgroup paths. It's particularly useful for visualizing the relationship between systemd units (like services, sockets, devices, mounts) and the underlying processes and their resource containers.
CAVEATS
systemd-cgls
provides a snapshot of the cgroup hierarchy at the time of execution; it does not update dynamically. Its output relies on the kernel's cgroup filesystem, and its behavior might slightly vary between cgroup v1 and cgroup v2 environments, though it generally adapts to the active cgroup version. It typically requires appropriate permissions (e.g., running as root) to access the cgroup filesystem for a complete view.
OUTPUT FORMAT
The command presents a hierarchical, tree-like view of the cgroup structure. Each line typically shows the cgroup path, followed by the process ID (PID) and the command name of processes residing within that cgroup. This visual representation makes it intuitive to understand the nesting of cgroups and the processes they contain, making it easy to trace processes to their associated systemd units.
TYPICAL USE CASES
Administrators commonly use systemd-cgls
to verify that processes are correctly placed into their intended systemd slices, scopes, or services.
It's also invaluable for identifying which unit a specific process belongs to, or for troubleshooting resource management issues by observing the cgroup structure and identifying processes consuming resources within a particular group.
It serves as a foundational tool for understanding and debugging systemd's resource control mechanisms.
HISTORY
systemd-cgls
was introduced as part of the systemd
suite, which began its development in 2010. As systemd
rapidly adopted and became the standard init system for many Linux distributions, its reliance on and management of Linux cgroups increased significantly. systemd-cgls
emerged as an essential tool to inspect and debug systemd
's cgroup organization, providing a human-readable representation of process placement within the cgroup hierarchy. Its core functionality has remained relatively stable, evolving primarily in parallel with the underlying cgroup kernel interfaces and systemd's cgroup management capabilities.
SEE ALSO
systemd(1), systemctl(1), systemd-cgtop(1), cgroup(7), machinectl(1)