Linux command
systemd-cgls 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Display the whole control group hierarchy
systemd-cgls
Display the cgroup tree for a specific controller
systemd-cgls [cpu|memory|io]
Display the control group hierarchy of specific units
systemd-cgls -u [unit1] [unit2]
Show all control groups including empty ones
systemd-cgls --all
Display without truncating process names
systemd-cgls -l
说明
systemd-cgls recursively shows the contents of the Linux control group (cgroup) hierarchy in a tree format. It displays which processes belong to which control groups, organized by systemd slices, scopes, and services. If arguments are specified, shows all member processes of the specified control groups plus their subgroups. If no argument is given and the current working directory is beneath /sys/fs/cgroup/, it shows the contents of that cgroup. Otherwise, the full systemd control group hierarchy is shown. The tool provides a clear visual representation of the cgroup nesting and processes, making it useful for understanding how systemd organizes processes and for debugging resource management issues.
参数
- -u, --unit _UNIT_
- Show the cgroup subtree of the specified systemd unit(s).
- -a, --all
- Show all control groups, including empty ones that contain no processes.
- -l, --full
- Do not ellipsize (truncate) process tree members.
- -k
- Include kernel threads in the output.
- --no-pager
- Do not pipe output into a pager.
- -M, --machine _CONTAINER_
- Show control group contents in the specified container.
- -h, --help
- Display help information.
FAQ
What is the systemd-cgls command used for?
systemd-cgls recursively shows the contents of the Linux control group (cgroup) hierarchy in a tree format. It displays which processes belong to which control groups, organized by systemd slices, scopes, and services. If arguments are specified, shows all member processes of the specified control groups plus their subgroups. If no argument is given and the current working directory is beneath /sys/fs/cgroup/, it shows the contents of that cgroup. Otherwise, the full systemd control group hierarchy is shown. The tool provides a clear visual representation of the cgroup nesting and processes, making it useful for understanding how systemd organizes processes and for debugging resource management issues.
How do I run a basic systemd-cgls example?
Run `systemd-cgls` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -u, --unit _UNIT_ do in systemd-cgls?
Show the cgroup subtree of the specified systemd unit(s).