cgroups (advanced)

Inspect and manage control groups that limit process resources.

medium risk

interactive breakdown — edit the command and press Explain
$ 
⚠ Risks & cautions
What it does

Cgroups (control groups) limit and account for CPU, memory, I/O, and network resources used by groups of processes. Containers use cgroups heavily. The systemd-cgls and systemd-cgtop tools visualize the cgroup hierarchy. Direct manipulation is via /sys/fs/cgroup/.

Examples
systemd-cglsShow cgroup hierarchy tree · explain & risk-check →
systemd-cgtopLive resource usage by cgroup (like top for cgroups) · explain & risk-check →
cat /sys/fs/cgroup/memory/system.slice/docker-<id>.scope/memory.limit_in_bytesView container memory limit · explain & risk-check →
cat /proc/1234/cgroupShow cgroups for a specific PID · explain & risk-check →
systemctl set-property nginx.service MemoryLimit=512MSet memory limit on a systemd service · explain & risk-check →
Pro tip

Use `systemctl set-property myservice.service CPUQuota=50%` and `MemoryLimit=1G` to apply resource limits to any systemd service without touching container runtimes.

Related
nsenter ps top
Open the full explainer →More in System & Processes

Reference text is hand-written and may be incomplete — check man cgroups for your version. Test destructive commands on a non-production system first.