systemctl Cheatsheet 2026: Complete Command Reference
Last updated: March 2026
Quick reference for systemctl, the command-line interface to systemd. All commands assume a Linux system running systemd (Ubuntu 20.04+, Debian 10+, RHEL 8+, Fedora, Arch, etc.). Commands that modify system state require sudo.
Service Control
| Command |
Description |
systemctl start unit |
Start a unit immediately |
systemctl stop unit |
Stop a running unit |
systemctl restart unit |
Stop then start a unit |
systemctl try-restart unit |
Restart only if currently active |
systemctl reload unit |
Reload configuration without stopping (unit must support it) |
systemctl reload-or-restart unit |
Reload if supported, otherwise restart |
systemctl status unit |
Show status, recent logs, and PID |
systemctl kill unit |
Send a signal to all processes of a unit |
systemctl kill -s SIGKILL unit |
Force-kill all processes |
Examples
sudo systemctl start nginx
sudo systemctl stop postgresql
sudo systemctl restart myapp
sudo systemctl reload nginx # reload nginx config in-place
sudo systemctl status sshd
Enable / Disable (Boot Persistence)
| Command |
Description |
systemctl enable unit |
Enable unit to start on boot |
systemctl enable --now unit |
Enable and start immediately |
systemctl disable unit |
Disable unit from starting on boot |
systemctl disable --now unit |
Disable and stop immediately |
systemctl is-enabled unit |
Check if enabled (enabled/disabled/static/masked) |
systemctl mask unit |
Prevent unit from being started (ever, by anything) |
systemctl unmask unit |
Remove mask |
systemctl preset unit |
Apply the vendor/distribution default enable state |
Examples
sudo systemctl enable --now nginx
sudo systemctl disable --now apache2
systemctl is-enabled sshd # → enabled
sudo systemctl mask bluetooth # block bluetooth from starting
sudo systemctl unmask bluetooth
System State
| Command |
Description |
systemctl poweroff |
Shut down and power off |
systemctl reboot |
Reboot the system |
systemctl halt |
Stop the OS without powering off |
systemctl suspend |
Suspend to RAM |
systemctl hibernate |
Suspend to disk |
systemctl hybrid-sleep |
Suspend to RAM and disk |
systemctl rescue |
Switch to rescue (single-user) mode |
systemctl emergency |
Switch to emergency mode |
systemctl default |
Return to default target |
systemctl isolate multi-user.target |
Switch to multi-user target |
systemctl isolate graphical.target |
Switch to graphical target |
systemctl get-default |
Show current default target |
systemctl set-default multi-user.target |
Set default target |
Examples
sudo systemctl reboot
sudo systemctl suspend
sudo systemctl get-default # → graphical.target
sudo systemctl set-default multi-user.target # server mode, no GUI
List Units
| Command |
Description |
systemctl list-units |
List all active units |
systemctl list-units --all |
List all units including inactive |
systemctl list-units --type=service |
List only service units |
systemctl list-units --type=socket |
List only socket units |
systemctl list-units --state=failed |
List failed units |
systemctl list-unit-files |
List all installed unit files and their state |
systemctl list-unit-files --type=service |
List service unit files |
systemctl list-timers |
List all timers and next trigger time |
systemctl list-timers --all |
Include inactive timers |
systemctl list-sockets |
List socket units and their addresses |
systemctl list-dependencies unit |
Show dependency tree for a unit |
systemctl list-dependencies --reverse unit |
Show what depends on this unit |
Examples
systemctl list-units --state=failed # see what broke
systemctl list-unit-files --state=enabled # see what starts on boot
systemctl list-timers # see scheduled tasks
systemctl list-dependencies nginx # what nginx needs
Inspect Units
| Command |
Description |
systemctl status unit |
Status, PID, recent log lines |
systemctl cat unit |
Show unit file content as loaded |
systemctl show unit |
Show all properties (key=value) |
systemctl show -p Restart unit |
Show a specific property |
systemctl edit unit |
Edit unit file (creates override.conf) |
systemctl edit --full unit |
Edit a full copy of the unit file |
systemd-analyze verify unit.service |
Check unit file syntax |
Examples
systemctl cat sshd.service # see the full unit file
systemctl show nginx -p ActiveState # → ActiveState=active
sudo systemctl edit myapp # add overrides without editing original
Logs with journalctl
| Command |
Description |
journalctl -u unit |
All logs for a unit |
journalctl -u unit -f |
Follow (live tail) |
journalctl -u unit -n 50 |
Last 50 lines |
journalctl -u unit -b |
Logs since current boot |
journalctl -u unit -b -1 |
Logs from previous boot |
journalctl -u unit --since "1 hour ago" |
Logs from last hour |
journalctl -u unit --since "2026-03-26 10:00" |
Logs since specific time |
journalctl -u unit --until "2026-03-26 12:00" |
Logs until specific time |
journalctl -u unit -p err |
Errors and above only |
journalctl -u unit -p warning..err |
Priority range |
journalctl -u unit -o json |
JSON output format |
journalctl -u unit --no-pager |
Print without pager |
journalctl -k |
Kernel messages (dmesg equivalent) |
journalctl -b |
All logs since current boot |
journalctl --disk-usage |
Show total log disk usage |
journalctl --vacuum-size=500M |
Trim logs to 500 MB |
journalctl --vacuum-time=30d |
Remove logs older than 30 days |
Examples
journalctl -u nginx -f # live follow nginx logs
journalctl -u myapp -n 100 --no-pager # last 100 lines, no pager
journalctl -u postgresql -p err --since "2 hours ago"
journalctl --disk-usage # e.g. "Archived and active journals take up 1.2G"
sudo journalctl --vacuum-size=500M # reduce to 500 MB
For detailed journalctl usage, see the journalctl filtering guide.
Boot Analysis
| Command |
Description |
systemd-analyze |
Total boot time |
systemd-analyze blame |
Time spent by each unit, sorted descending |
systemd-analyze critical-chain |
Show critical path (slowest chain) |
systemd-analyze critical-chain unit |
Critical chain for specific unit |
systemd-analyze plot > boot.svg |
Generate SVG boot timeline |
systemd-analyze verify unit.service |
Syntax check a unit file |
systemd-analyze security unit.service |
Security exposure score |
Examples
systemd-analyze
# Startup finished in 2.345s (kernel) + 8.123s (userspace) = 10.468s
systemd-analyze blame | head -10 # top 10 slowest services
systemd-analyze critical-chain
# The time when unit became active or started is printed after the "@" character.
# @8.123s
# └─multi-user.target @8.123s
# └─myapp.service @6.000s +2.123s
systemd-analyze security myapp.service
# → UNSAFE 9.6
Common Patterns
Service fails to start — quick diagnosis
# 1. Check status
systemctl status myapp
# 2. Check recent logs
journalctl -u myapp -n 50 --no-pager
# 3. Check syntax
systemd-analyze verify /etc/systemd/system/myapp.service
# 4. After fixing the unit file, reload and retry
sudo systemctl daemon-reload
sudo systemctl start myapp
Apply unit file changes
sudo systemctl daemon-reload # required after any file edit
sudo systemctl restart myapp # apply to running service
One-liner: enable, start, and check
sudo systemctl enable --now myapp && systemctl status myapp
Find all services that failed across all boots
journalctl -p err -b --no-pager | grep "Failed"
Related Articles