CGGET(1)

πŸ’– CGGET(1) β€” libcgroup manual, but make it a group chat πŸ’–

okay bestie, pull up a chair because this one is so useful. it's cgget, from the libcgroup manual, and it's basically the "show me what's in there" tool for control groups. no cap.


✨ NAME ✨

cgget β€” print parameter(s) of given group(s). that's it, that's the whole job. she reads, she reports, she does not write. an icon who minds her business πŸ’…


🌸 SYNOPSIS 🌸

cgget [-n] [-v] [-m] [-b] [-r <name>] [-g <controller>] [-a] <path> ...
cgget [-n] [-v] [-m] [-b] [-r <name>] -g <controller>:<path> ...

two whole ways to run her, pick your fighter 🫢


πŸ¦‹ DESCRIPTION πŸ¦‹

so the vibe is: she prints the parameter(s) of the input cgroup(s). simple. clean. iconic.

and here's the cute part β€” if you don't specify neither controller nor variable, she just shows you the values of all possible variables. maximalist queen behavior, honestly. why choose.

  • <path> β€” the name of the cgroup she should read, bestie. and yes, you can pass this parameter multiple times because she's not a one-path kind of girl.

πŸŽ€ OPTIONS πŸŽ€

  • -a, --all β€” prints the variables for all controllers which consist in the given cgroup. all of them. she said "give me everything" and she meant it ✨
  • -b β€” ignores the default systemd delegated hierarchy path and constructs the path of the control groups relative to the cgroup root hierarchy. lowkey a path-rewrite moment.
  • -c β€” displays the controllers and their versions. this option can be used along with -m, they're besties 🫢
  • -g <controller> β€” defines controllers whose values should be displayed. this option can be used multiple times, stack 'em up.
  • -g <controller>:<path> β€” defines control groups whose values should be displayed. also can be used multiple times. same flag, different energy, iykyk.
  • -h, --help β€” display help and exit. the classic escape hatch πŸšͺ
  • -m β€” displays the current control groups setup mode. and there are three modes she might report, bestie, so let me lay them out:
    • legacy β€” cgroup v1 only
    • unified β€” cgroup v2 only
    • hybrid β€” cgroup v1/v2

the way that's literally a whole personality quiz for your kernel 😭

  • -n β€” do not print headers, i.e. names of groups. she goes straight to the tea, no intros.
  • -r, --variable <name> β€” defines the parameter to display. this option can be used multiple times. yes queen, ask for as many as you want.
  • -v, --values-only β€” print only values, not parameter names. minimalism. clean lines. no notes.

🌈 EXAMPLES 🌈

okay now the fun part, let's actually watch her cook πŸ“

ask for specific variables on two groups, headers included:

$ cgget -r cpuset.cpus -r cpuset.mems first second
first:
cpuset.cpus=0-1
cpuset.mems=0

second:
cpuset.cpus=0
cpuset.mems=0

same thing but with -n so she drops the headers and just stacks the output:

$ cgget -n -r cpuset.cpus -r cpuset.mems first second
cpuset.cpus=0-1
cpuset.mems=0
cpuset.cpus=0
cpuset.mems=0

now add -v and it's just the numbers, nothing else, immaculate:

$ cgget -nv -r cpuset.cpus -r cpuset.mems first second
0-1
0
0
0

and here she is grabbing a whole controller's worth of variables off the root:

$ cgget -n -g cpu /
cpu.rt_period_us=1000000
cpu.rt_runtime_us=950000
cpu.shares=1024

and finally, the mode check β€” one flag, one answer:

$ cgget -m
Unified Mode (Cgroup v2 only).

slay. πŸ”₯


πŸ’œ ENVIRONMENT VARIABLES πŸ’œ

  • CGROUP_LOGLEVEL β€” controls verbosity of the tool. the allowed values are DEBUG, INFO, WARNING or ERROR. pick your chatter level, babe 🧚

πŸ‘‘ SEE ALSO πŸ‘‘

go read these next, bestie, they're all part of the lore:

  • cgrules.conf (1)
  • cgcreate (1)
  • cgget (1)

real talk though: nothing here is dangerous, she's read-only and just tells you things. go wild. 🫢

okay that's the whole page!! this came from the Linux manual, libcgroup era, dated 2010-01-18, filed under CGGET(1). periodt πŸ’…βœ¨

πŸ“¦ where this page comes from