systemctl Cheatsheet 2026: Complete Command Reference

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

CommandDescription
systemctl start unitStart a unit immediately
systemctl stop unitStop a running unit
systemctl restart unitStop then start a unit
systemctl try-restart unitRestart only if currently active
systemctl reload unitReload configuration without stopping (unit must support it)
systemctl reload-or-restart unitReload if supported, otherwise restart
systemctl status unitShow status, recent logs, and PID
systemctl kill unitSend a signal to all processes of a unit
systemctl kill -s SIGKILL unitForce-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)

CommandDescription
systemctl enable unitEnable unit to start on boot
systemctl enable --now unitEnable and start immediately
systemctl disable unitDisable unit from starting on boot
systemctl disable --now unitDisable and stop immediately
systemctl is-enabled unitCheck if enabled (enabled/disabled/static/masked)
systemctl mask unitPrevent unit from being started (ever, by anything)
systemctl unmask unitRemove mask
systemctl preset unitApply 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

CommandDescription
systemctl poweroffShut down and power off
systemctl rebootReboot the system
systemctl haltStop the OS without powering off
systemctl suspendSuspend to RAM
systemctl hibernateSuspend to disk
systemctl hybrid-sleepSuspend to RAM and disk
systemctl rescueSwitch to rescue (single-user) mode
systemctl emergencySwitch to emergency mode
systemctl defaultReturn to default target
systemctl isolate multi-user.targetSwitch to multi-user target
systemctl isolate graphical.targetSwitch to graphical target
systemctl get-defaultShow current default target
systemctl set-default multi-user.targetSet 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

CommandDescription
systemctl list-unitsList all active units
systemctl list-units --allList all units including inactive
systemctl list-units --type=serviceList only service units
systemctl list-units --type=socketList only socket units
systemctl list-units --state=failedList failed units
systemctl list-unit-filesList all installed unit files and their state
systemctl list-unit-files --type=serviceList service unit files
systemctl list-timersList all timers and next trigger time
systemctl list-timers --allInclude inactive timers
systemctl list-socketsList socket units and their addresses
systemctl list-dependencies unitShow dependency tree for a unit
systemctl list-dependencies --reverse unitShow 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

CommandDescription
systemctl status unitStatus, PID, recent log lines
systemctl cat unitShow unit file content as loaded
systemctl show unitShow all properties (key=value)
systemctl show -p Restart unitShow a specific property
systemctl edit unitEdit unit file (creates override.conf)
systemctl edit --full unitEdit a full copy of the unit file
systemd-analyze verify unit.serviceCheck 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

CommandDescription
journalctl -u unitAll logs for a unit
journalctl -u unit -fFollow (live tail)
journalctl -u unit -n 50Last 50 lines
journalctl -u unit -bLogs since current boot
journalctl -u unit -b -1Logs 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 errErrors and above only
journalctl -u unit -p warning..errPriority range
journalctl -u unit -o jsonJSON output format
journalctl -u unit --no-pagerPrint without pager
journalctl -kKernel messages (dmesg equivalent)
journalctl -bAll logs since current boot
journalctl --disk-usageShow total log disk usage
journalctl --vacuum-size=500MTrim logs to 500 MB
journalctl --vacuum-time=30dRemove 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

CommandDescription
systemd-analyzeTotal boot time
systemd-analyze blameTime spent by each unit, sorted descending
systemd-analyze critical-chainShow critical path (slowest chain)
systemd-analyze critical-chain unitCritical chain for specific unit
systemd-analyze plot > boot.svgGenerate SVG boot timeline
systemd-analyze verify unit.serviceSyntax check a unit file
systemd-analyze security unit.serviceSecurity 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

Leonardo Lazzaro

Software engineer and technical writer. 10+ years experience in DevOps, Python, and Linux systems.

More articles by Leonardo Lazzaro