Skip to main content

Systemd Cheatsheet

systemd is the de facto standard init system and service manager on modern Linux. This cheatsheet organizes essential systemd commands by category — service control, timers, journald logs, unit management, boot analysis, and socket activation — each with practical examples.

Updated: 2026-07-16·40 commands

Quick Reference

TaskCommand
Start a servicesystemctl start nginx
Check service statussystemctl status nginx
Follow logs in real-timejournalctl -u nginx -f
Schedule recurring jobssystemd timer unit
Analyze boot speedsystemd-analyze blame
View active socketssystemctl list-sockets

Service Management

``bash # Start / Stop / Restart / Reload systemctl start nginx.service # Start service (.service can be omitted) systemctl stop nginx # Stop service systemctl restart nginx # Restart service systemctl reload nginx # Reload config (no service interruption) systemctl reload-or-restart nginx # Reload if supported, else restart

# Enable / Disable (auto-start on boot) systemctl enable nginx # Enable auto-start at boot systemctl enable --now nginx # Enable and start immediately systemctl disable nginx # Disable auto-start systemctl disable --now nginx # Disable and stop immediately

# Check service status systemctl status nginx # Detailed status (with recent logs) systemctl is-active nginx # Check if running (active/inactive) systemctl is-enabled nginx # Check if enabled (enabled/disabled) systemctl is-failed nginx # Check if failed

# mask / unmask (complete lockdown) systemctl mask nginx # Mask service (cannot be started manually) systemctl unmask nginx # Unmask service `

Timer Management

`bash # List timers systemctl list-timers # List all timers (with next trigger time) systemctl list-timers --all # List all (including expired) systemctl status myapp.timer # View timer status

# Timer operations systemctl start myapp.timer # Start timer systemctl enable myapp.timer # Enable timer auto-start systemctl stop myapp.timer # Stop timer systemctl disable myapp.timer # Disable timer

# Manually trigger a timer service systemctl start myapp.service # Manually trigger associated service

# View timer logs journalctl -u myapp.timer # View timer logs journalctl -u myapp.service # View service execution logs `

Journal Logs

`bash # Basic viewing journalctl # View all logs (less pager) journalctl -n 50 # View last 50 log entries journalctl -f # Follow new log entries (like tail -f) journalctl -e # Jump to end of log

# Filter by service journalctl -u nginx # View logs for a specific service journalctl -u nginx -u sshd # View logs for multiple services journalctl -u nginx -f # Follow logs for a specific service

# Filter by time journalctl --since today # View logs since today journalctl --since "2026-07-15" # From a specific date journalctl --until "1 hour ago" # Up to one hour ago journalctl --since "2026-07-15 09:00" --until "2026-07-15 18:00"

# Filter by priority journalctl -p err # Show only error level and above journalctl -p warning # Warning and above journalctl -p err -u nginx # Combined filtering

# Output formats journalctl -o json # JSON format output journalctl -o verbose # Verbose (all fields) journalctl -o short-monotonic # Monotonic timestamp format

# Disk management journalctl --disk-usage # Check journal disk usage journalctl --vacuum-size=500M # Keep only last 500M of logs journalctl --vacuum-time=30d # Keep only last 30 days of logs `

Unit Management

`bash # List units systemctl list-units # List all active units systemctl list-units --type=service # List all service units systemctl list-units --type=timer # List all timer units systemctl list-units --type=socket # List all socket units systemctl list-units --state=running # List running units systemctl list-unit-files # List all unit files with enable status

# Unit operations systemctl cat nginx.service # View unit file contents systemctl show nginx.service # View detailed unit properties systemctl list-dependencies nginx # View unit dependencies systemctl help nginx.service # View unit's man page

# System state systemctl daemon-reload # Reload unit files (required after changes) systemctl reset-failed nginx # Clear failed state systemctl is-system-running # Check system state (running/degraded)

# Edit unit files systemctl edit nginx.service # Create drop-in override systemctl edit --full nginx.service # Edit full unit file

# Mask / unmask systemctl mask nginx.service # Mask unit (cannot be started) systemctl unmask nginx.service # Unmask unit `

Boot Analysis

`bash # Boot time analysis systemd-analyze # View total boot time systemd-analyze time # Same (detailed) systemd-analyze blame # Sort services by init time (find the slowest) systemd-analyze critical-chain # Show critical boot chain systemd-analyze plot > boot.svg # Generate boot timeline SVG

# Dependency analysis systemd-analyze dot nginx.service # Generate dependency graph (DOT format) systemd-analyze dot | dot -Tsvg > deps.svg # Generate dependency SVG

# Security audit systemd-analyze security # Security score for all services systemd-analyze security nginx.service # Security score for a specific service

# Environment checks systemd-analyze verify /etc/systemd/system/myapp.service # Validate unit file systemd-analyze condition 'ConditionPathExists=/etc/nginx' # Test conditions

# SysV compatibility systemd-analyze sysv-chkconfig # List SysV-compatible services `

Socket Activation

`bash # List socket units systemctl list-sockets # List all sockets and their associated services systemctl list-units --type=socket # List all socket units

# Socket operations systemctl start myapp.socket # Start socket listener systemctl enable myapp.socket # Enable socket auto-start systemctl status myapp.socket # View socket status

# Socket configuration info systemctl show myapp.socket # View socket configuration details ss -tlnp | grep myapp # View actual listening ports

# Check listening status systemctl is-active myapp.socket # Check if socket is listening journalctl -u myapp.socket # View socket-related logs ``

Service Mgmt(10)

CommandLevel
systemctl start
Start a service
Basic
systemctl stop
Stop a service
Basic
systemctl restart
Restart a service
Basic
systemctl reload
Reload service configuration (zero-downtime)
Intermediate
systemctl enable
Enable service to auto-start at boot
Basic
systemctl disable
Disable service auto-start at boot
Basic
systemctl enable --now
Enable and start service immediately
Basic
systemctl status
View detailed service status (with recent logs)
Basic
systemctl is-active / is-enabled / is-failed
Check service running/enabled/failed status
Intermediate
systemctl mask / unmask
Mask/unmask a service (completely prevent startup)
Expert

Timer(4)

CommandLevel
systemctl list-timers
List all timers with next trigger times
Basic
systemctl start myapp.timer
Start a timer
Basic
systemctl enable myapp.timer
Enable timer auto-start at boot
Basic
journalctl -u myapp.timer
View timer-related logs
Intermediate

Journal(8)

CommandLevel
journalctl
View all system logs (less pager)
Basic
journalctl -f
Follow logs in real-time (like tail -f)
Basic
journalctl -u
Filter logs by service unit
Basic
journalctl --since / --until
Filter logs by time range
Intermediate
journalctl -p
Filter logs by priority level
Intermediate
journalctl -o json
Output logs in JSON format
Intermediate
journalctl --disk-usage
Check log disk usage
Intermediate
journalctl --vacuum-size / --vacuum-time
Limit log disk usage or retention time
Expert

Units(7)

CommandLevel
systemctl list-units
List all active units
Basic
systemctl list-unit-files
List all unit files with their enable status
Basic
systemctl cat
View unit file contents
Intermediate
systemctl show
View detailed unit properties
Intermediate
systemctl list-dependencies
View unit dependency chain
Intermediate
systemctl daemon-reload
Reload unit files (required after modifications)
Basic
systemctl edit
Edit unit file (create drop-in override)
Expert

Boot(6)

CommandLevel
systemd-analyze time
View total system boot time
Basic
systemd-analyze blame
Show services sorted by init time (find slowest)
Intermediate
systemd-analyze critical-chain
Show critical boot chain (bottleneck analysis)
Intermediate
systemd-analyze plot
Generate boot timeline graph (SVG format)
Intermediate
systemd-analyze security
Audit service security scores
Expert
systemd-analyze verify
Validate unit file syntax
Expert

Socket Activation(5)

CommandLevel
systemctl list-sockets
List all socket listeners and their associated services
Basic
systemctl start myapp.socket
Start socket listener
Intermediate
systemctl enable myapp.socket
Enable socket auto-start at boot
Intermediate
systemctl show myapp.socket
View socket configuration details
Intermediate
systemctl is-active myapp.socket
Check if socket is actively listening
Intermediate

FAQ

This cheatsheet is compiled from official tool documentation. Last updated: 2026-07-16.