Overview
systemd-cgls visualizes system resource management and isolation by leveraging the cgroup functionality of the Linux kernel. It displays the process IDs (PIDs) belonging to each cgroup and its child cgroups in a tree format, making it easier to understand the complex resource allocation structure of the system.
Key Features
- Visualizes cgroup hierarchy
- Displays Process IDs (PIDs) within each cgroup
- Checks system resource isolation and allocation status
- Understands how services, user sessions, etc., are grouped by resources
Key Options
The main options for the systemd-cgls command are used to control the scope and format of the displayed cgroup information.
Display/Filtering Options
Other Options
Generated command:
Try combining the commands.
Description:
`systemd-cgls` Executes the command.
Combine the above options to virtually execute commands with AI.
Usage Examples
Learn how to effectively query cgroup information through various usage examples of the systemd-cgls command.
Display basic cgroup hierarchy
systemd-cgls
Displays the system's basic cgroup hierarchy and the process IDs within each group.
Show all cgroups, including empty ones
systemd-cgls -a
Displays all cgroups, including empty ones, not just currently active ones, to understand the overall cgroup structure.
Display cgroups for a specific systemd unit
systemd-cgls --unit sshd.service
For example, checks cgroup information related to the SSH daemon (sshd.service).
Show full paths for user session cgroups
systemd-cgls -p --unit user@1000.service
Retrieves detailed information including the full path for the session cgroup of user ID 1000. User ID can be found using the `id -u` command.
Show all cgroups without truncating output
systemd-cgls --full -a
Displays the full cgroup paths or names without truncation, including empty cgroups.
Tips & Notes
systemd-cgls is very useful for understanding and debugging the system's resource management status. You can use the following tips to use the command more effectively.
Understanding cgroups
cgroup is a Linux kernel feature that manages resource (CPU, memory, I/O, etc.) allocation and limits for process groups. systemd utilizes this feature to isolate and manage services, user sessions, and more.
- Use Cases: Analyzing system resource usage, checking service isolation status, tracing specific process groups during troubleshooting.
- Integration with other commands: Can be used in conjunction with `systemctl status` to check the cgroup information of a specific service, or compared with `ps auxf` to understand the process tree.
Interpreting Output
In the displayed tree structure, each node represents a cgroup, and the numbers listed below it are the PIDs of the processes belonging to that cgroup. This allows for an intuitive understanding of which processes are part of which resource group.