Filters
Zo zoek je
  • Gewone woorden vinden namen, teksten en voorbeelden.
  • "twee woorden" vindt precies die zin.
  • --naam of -x vindt een optie.
  • #woord zoekt alleen in commando's.
  • @grep vindt lessen en labs die grep gebruiken.
  • Filters: cat:network · in:labs · in:notes · level:rhcsa · ch:8 · root:yes. Zet ! voor een woord om het weg te laten. OR tussen woorden betekent één ervan.
  • ↑ ↓ bewegen · Enter openen · Esc sluiten · / zoeken

systemd-cgls

Show the control groups (cgroups) as a tree with their processes (systemd-cgls), or their live resource use (systemd-cgtop).

Niveau
Dagelijks Linux
Groep
Processen en jobs
Root nodig
Nee
Pakket
systemd
Ook
systemd-cgtop

Dit deel is nog niet vertaald. Je ziet de Engelse tekst.

Wat het doet

systemd puts every service, user session and container in its own cgroup, grouped in slices: system.slice, user.slice, machine.slice. systemd-cgls shows which process belongs to which service — useful when ps does not tell you where a process comes from. systemd-cgtop shows CPU, memory and I/O per cgroup, like top.

Zo schrijf je het

systemd-cgls [OPTION]... [CGROUP...]
systemd-cgls [OPTION]... --unit|--user-unit [UNIT...]
systemd-cgtop [OPTION]... [GROUP]

Opties 26

Meest gebruikt

systemd-cgls

-u, --unit [UNIT]
Show the cgroup of these units.
--user-unit [UNIT]
Show user units.
-a, --all
Also empty cgroups.
-l, --full
Do not cut lines.
-k
Also kernel threads.
-x, --xattr=yes|no
Show extended attributes.
-c, --cgroup-id=yes|no
Show cgroup IDs.
-M, --machine=NAME
Show a container or VM.
--no-pager
Do not use a pager.
-h, --help
Show help.
--version
Show the version.

systemd-cgtop

-c, --order=cpu
Sort by CPU.
-m, --order=memory
Sort by memory.
-i, --order=io
Sort by I/O.
-t, --order=tasks
Sort by number of tasks.
-p, --order=path
Sort by path.
-b, --batch
Batch mode (for pipes).
-n, --iterations=N
Stop after N updates.
-d, --delay=SECONDS
Time between updates.
-1
One update only.
-r, --raw
Raw numbers.
-P
Count only user processes.
-k
Count all processes, also kernel threads.
--cpu=percentage|time
Show CPU as percent or time.
--depth=N
How deep the tree goes.
--recursive=yes|no
Include child cgroups in the numbers.

Voorbeelden 10

$ als gewone gebruiker# als root (of met sudo)

  1. 1The whole tree

    systemd-cgls --no-pager | head -25

    Slices, services and their processes.

  2. 2One service

    systemd-cgls -u httpd.service

    All processes of the web server, also CGI children.

  3. 3Where does this process come from?

    systemctl status 4123

    Shows the unit and cgroup of a PID.

  4. 4Your own session

    systemd-cgls -u user-1000.slice

    Everything you started.

  5. 5Live resource use per service

    systemd-cgtop

    Press m, c, i to sort.

  6. 6Sorted by memory, one snapshot

    systemd-cgtop -m -1 -b | head

    For a report.

  7. 7Container processes

    systemd-cgls -u machine.slice

    VMs and containers.

  8. 8Cgroup of a process directly

    cat /proc/4123/cgroup
    0::/system.slice/httpd.service

    cgroup v2 path.

  9. 9Limit a service with cgroups

    systemctl set-property httpd.service MemoryMax=1G CPUQuota=50%

    Resource limits are set on the cgroup.

  10. 10Find hidden processes of a service (security)

    systemd-cgls -u sshd.service

    A strange child (like a miner) under a service shows up here.

Exitcodes

0 :: Done. 1 :: Error.

Volledige handleiding

Deze pagina legt het commando uit in eenvoudige woorden. De originele handleiding heeft elk detail.

In je terminal: man systemd-cgls