SYSTEMD-CGTOP(1)

๐Ÿ’– SYSTEMD-CGTOP ๐Ÿ’–

okay bestie, welcome to systemd-cgtop โ€” the manual page, but make it cute.


โœจ NAME โœจ

systemd-cgtop โ€” show top control groups by their resource usage ๐Ÿ‘‘


๐ŸŒธ SYNOPSIS ๐ŸŒธ

systemd-cgtop [OPTIONS...] [GROUP]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

So systemd-cgtop shows you the top control groups of your local Linux control group hierarchy, sorted by their CPU, memory, or disk I/O load. It refreshes on a regular interval (by default every 1s), and the vibe is very top(1)-core, honestly. And if you pass a control group path, it shows you only the services of that specified control group. slay.

Now, plot twist: if systemd-cgtop is not connected to a tty, it prints no column headers and by default it only runs one single iteration. The --iterations= argument, if you give it one, is still honored. This mode is literally made for scripting, no cap. ๐Ÿ–ฅ๏ธ

Resource usage is only accounted for control groups with the appropriate controllers turned on: the "memory" controller for memory usage, and the "io" controller for disk I/O consumption. So if you actually need resource monitoring for these things, it is recommended that you add the MemoryAccounting=1 and IOAccounting=1 settings in the unit files in question. Go read systemd.resource-control(5) for the details, bestie. ๐Ÿ“–

The CPU load value can be between 0 and 100 times the number of processors your system has. Like, say your system has 8 processors โ€” then the CPU load value is gonna be between 0% and 800%. The number of processors can be found in /proc/cpuinfo. math is mathing โœจ

And to emphasize, because this part matters: unless "MemoryAccounting=1" and "IOAccounting=1" are enabled for the services in question, no resource accounting will be available for system services and the data shown by systemd-cgtop will be incomplete. ๐Ÿ’€


๐Ÿ’… OPTIONS ๐Ÿ’…

The following options are understood:

  • -p, --order=path โ€” order by control group path name.
  • -t, --order=tasks โ€” order by number of tasks/processes in the control group.
  • -c, --order=cpu โ€” order by CPU load.
  • -m, --order=memory โ€” order by memory usage.
  • -i, --order=io โ€” order by disk I/O load.
  • -b, --batch โ€” run in "batch" mode: it does not accept input and runs until the iteration limit set with --iterations= is exhausted or until killed. This mode could be useful for sending output from systemd-cgtop to other programs or to a file.

Added in version 188.

  • -r, --raw โ€” format byte counts (as in memory usage and I/O metrics) and CPU time with raw numeric values rather than human-readable numbers.

Added in version 221.

  • --cpu=percentage, --cpu=time โ€” controls whether the CPU usage is shown as percentage or time. By default, the CPU usage is shown as percentage. When the option is used without an argument, it is equivalent to --cpu=time. This setting may also be toggled at runtime by pressing the % key.

Added in version 226.

  • -P โ€” count only userspace processes instead of all tasks. By default, all tasks are counted: each kernel thread and each userspace thread individually. With this setting, kernel threads are excluded from the count and each userspace process only counts as one task, regardless of how many threads it consists of. This setting may also be toggled at runtime by pressing the P key. This option may not be combined with -k.

Added in version 227.

  • -k โ€” count only userspace processes and kernel threads instead of all tasks. By default, all tasks are counted: each kernel thread and each userspace thread individually. With this setting, kernel threads are included in the count and each userspace process only counts as one task, regardless of how many threads it consists of. This setting may also be toggled at runtime by pressing the k key. This option may not be combined with -P.

Added in version 226.

  • --recursive= โ€” controls whether the number of processes shown for a control group shall include all processes that are contained in any of the child control groups as well. Takes a boolean argument, which defaults to "yes". If enabled, the processes in child control groups are included; if disabled, only the processes in the control group itself are counted. This setting may also be toggled at runtime by pressing the r key. Note that this setting only applies to process counting, i.e. when the -P or -k options are used. When all tasks are counted, setting this option to "no" is rejected with an error, as task counting is always recursive. ๐Ÿšซ

Added in version 226.

  • -n, --iterations= โ€” perform only this many iterations. A value of 0 indicates that the program should run indefinitely.

Added in version 188.

  • -1 โ€” a shortcut for --iterations=1.

Added in version 238.

  • -d, --delay= โ€” specify refresh delay in seconds (or if one of "ms", "us", "min" is specified as unit in this time unit). This setting may also be increased and decreased at runtime by pressing the + and - keys.
  • --depth= โ€” maximum control group tree traversal depth. Specifies how deep systemd-cgtop shall traverse the control group hierarchies. If 0 is specified, only the root group is monitored. For 1, only the first level of control groups is monitored, and so on. Defaults to 3.
  • -M MACHINE, --machine=MACHINE โ€” limit control groups shown to the part corresponding to the container MACHINE. This option may not be used when a control group path is specified.

Added in version 227.

  • -h, --help โ€” print a short help text and exit.
  • --version โ€” print a short version string and exit.

๐ŸŽ€ KEYS ๐ŸŽ€

systemd-cgtop is an interactive tool and may be controlled via user input using the following keys:

  • h โ€” shows a short help text.
  • Space โ€” immediately refresh output.

Added in version 226.

  • q โ€” terminate the program.
  • p, t, c, m, i โ€” sort the control groups by path, number of tasks, CPU load, memory usage, or I/O load, respectively. This setting may also be controlled using the --order= command line switch.
  • % โ€” toggle between showing CPU time as time or percentage. This setting may also be controlled using the --cpu= command line switch.

Added in version 201.

  • +, - โ€” increase or decrease refresh delay, respectively. This setting may also be controlled using the --delay= command line switch.
  • P โ€” toggle between counting all tasks, or only userspace processes. This setting may also be controlled using the -P command line switch (see above).

Added in version 227.

  • k โ€” toggle between counting all tasks, or only userspace processes and kernel threads. This setting may also be controlled using the -k command line switch (see above).

Added in version 226.

  • r โ€” toggle between recursively including or excluding processes in child control groups in control group process counts. This setting may also be controlled using the --recursive= command line switch. This key is not available if all tasks are counted; it is only available if processes are counted, as enabled with the P or k keys.

Added in version 226.


๐ŸŒˆ EXIT STATUS ๐ŸŒˆ

On success, 0 is returned, a non-zero failure code otherwise. simple as that ๐Ÿ’–


๐Ÿ‘‘ SEE ALSO ๐Ÿ‘‘

systemd(1), systemctl(1), systemd-cgls(1), systemd.resource-control(5), top(1)


okay that's the whole page, bestie ๐Ÿซถ this one's straight from systemd 262.1 โ€” go forth and watch your cgroups eat CPU, mwah ๐Ÿ’…โœจ

๐Ÿ“ฆ where this page comes from
  • arch rolling: systemd 262.1-1 ยท LGPL-2.1-or-later AND CC0-1.0 AND GPL-2.0-or-later AND MIT-0
  • ๐Ÿ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms