cgget
Get cgroup parameters
SYNOPSIS
cgget [-h] [-V] [-a] [-r param-list] [-g controller:param-list] [-l] [-d delimiter] [-s separator] [-1] [path]
PARAMETERS
-a, --all
Display all parameters available in the cgroup
-r param-list, --param-list=param-list
Comma-separated list of parameters to retrieve (e.g., cpu.shares,memory.limit_in_bytes)
-g controller:param-list, --cg-param-list=controller:param-list
Controller-specific parameters (e.g., cpu:shares)
-l, --long
Long format output (default)
-d delimiter, --delimiter=delimiter
Delimiter between path and value (default ': ')
-s separator, --separator=separator
Separator between parameters (default space)
-1, --one-line
One line per path instead of multi-line
-h, --help
Print usage information
-V, --version
Print version number
DESCRIPTION
cgget is a command-line utility from the libcgroup package used to query and display values of control group (cgroup) parameters in Linux.
Control groups organize processes hierarchically and allocate system resources such as CPU time, memory, and I/O among them. cgget reads these parameter values from the cgroup filesystem, typically mounted at /sys/fs/cgroup.
It supports fetching specific parameters (e.g., cpu.shares, memory.limit_in_bytes) or all available ones for a given cgroup path. Paths can be absolute (e.g., /sys/fs/cgroup/cpuacct/mygroup) or relative, and controllers like cpu, memory, or blkio can be specified.
Common use cases include monitoring resource limits, checking task counts, or verifying configurations set by tools like cgcreate or cgset. Output formats are flexible, with options for delimiters, separators, and one-line summaries, making it suitable for scripting and parsing.
Note that cgget primarily targets cgroup v1 hierarchies; cgroup v2 (default in modern kernels) favors systemd tools.
CAVEATS
Primarily for cgroup v1; cgroup v2 requires systemd or direct /sys/fs/cgroup access. Needs read permissions on cgroup files. Paths default to current process's cgroup if omitted.
EXAMPLES
cgget cpu.shares
Retrieve cpu.shares for current cgroup.
cgget -a /sys/fs/cgroup/memory/mygroup
Show all memory cgroup parameters.
cgget -r tasks,cpu.shares -1
One-line output of tasks and cpu.shares.
HISTORY
Developed as part of libcgroup project (circa 2007-2010) for user-space cgroup v1 management on RHEL/CentOS. Maintained until ~2016; largely replaced by systemd in modern distros with cgroup v2 support.
SEE ALSO
cgset(1), cgcreate(1), cgdelete(1), cgexec(1), cgrulesengd(8), systemd-cgtop(1)


