LinuxCommandLibrary

lscgroup

List control group hierarchy

SYNOPSIS

lscgroup [OPTIONS]

PARAMETERS

-h, --help
    Display a help message and exit.

-v, --version
    Show version information and exit.

DESCRIPTION

lscgroup is a command-line utility from the libcgroup tools package, designed to display information about the Linux control group (cgroup) hierarchies currently mounted on the system. It provides a high-level overview of how cgroups are organized, showing each distinct hierarchy, the cgroup controllers (subsystems) associated with it, and its mount point within the cgroupfs virtual filesystem.

This command is crucial for understanding the current cgroup setup, identifying which resource management controllers (like CPU, memory, I/O) are active, and where they are located in the filesystem. Unlike other tools that list individual cgroups, lscgroup focuses solely on the top-level hierarchy structure. It helps system administrators and developers verify the configuration of resource isolation and allocation policies. While primarily associated with cgroup v1, it can also reflect the unified cgroup v2 hierarchy if it's in use.

CAVEATS

Users typically need appropriate permissions, often root privileges, to fully access and interpret cgroup filesystem information, although listing hierarchies usually works for non-root users if the cgroup filesystems are readable.

lscgroup only displays the top-level cgroup hierarchies and their associated controllers; it does not list individual cgroups or tasks within those hierarchies. For detailed information about specific cgroups, other tools like cgget or direct inspection of the /sys/fs/cgroup paths are required.

Its output primarily reflects the Cgroup v1 multi-hierarchy model, but it can also show the unified Cgroup v2 hierarchy if it's mounted. Understanding which cgroup version is in use on your system is important for interpreting the output correctly.

OUTPUT FORMAT

The output of lscgroup typically presents each cgroup hierarchy on a new line, showing its unique identifier (often a numeric ID), the name of the hierarchy (or "name=systemd" for the unified hierarchy), a comma-separated list of cgroup controllers (subsystems) attached to that hierarchy, and the mount point path in the virtual cgroupfs filesystem (e.g., /sys/fs/cgroup/cpu,cpuacct). This provides a quick overview of which resource types are being managed together within each distinct cgroup tree.

CGROUP VERSIONS

Linux control groups have two main versions: Cgroup v1 and Cgroup v2. lscgroup can display information for both. Cgroup v1 allows multiple independent hierarchies, where different controllers can be mounted separately (e.g., CPU on one hierarchy, memory on another). Cgroup v2 introduces a unified hierarchy, where all controllers are managed under a single tree. The output of lscgroup will show separate lines for v1 hierarchies and typically one line for the unified v2 hierarchy if it's mounted, often named "name=systemd" or similar.

HISTORY

lscgroup is an integral part of the libcgroup project, which provides a comprehensive suite of utilities and a library for managing Linux control groups. Its development coincided with the initial integration of cgroups (cgroup v1) into the Linux kernel, offering a command-line interface to inspect and manage resource isolation features.

For many years, libcgroup tools, including lscgroup, were the primary way system administrators interacted with cgroups directly. While systemd has since become the dominant cgroup manager on most modern Linux distributions, abstracting much of the direct cgroup interaction, lscgroup remains valuable for low-level inspection and understanding the underlying cgroup hierarchy structure, especially in environments where systemd is not used or where a detailed view of the cgroupfs mounts is needed.

SEE ALSO

lssubsys(1), cgcreate(1), cgget(1), cgroups(7), systemd.resource-control(5), mount(8)

Copied to clipboard