Linux systemd Services Cheat Sheet

Core systemctl commands, unit inspection, service lifecycle management, dependencies, and operational workflows.

View
StandardDetailedCompact
Export
Copy the compact sheet, download it, or print it.
Download
`D` dense toggle · `C` copy all
## Service Lifecycle
Start a service
sudo systemctl start nginx

# Start a unit immediately.

Stop a service
sudo systemctl stop nginx

# Stop a running service.

Restart a service
sudo systemctl restart nginx

# Restart a running service.

Reload a service
sudo systemctl reload nginx

# Reload config without full restart if supported.

Try reload or restart
sudo systemctl reload-or-restart nginx

# Reload when possible, restart otherwise.

Show service status
systemctl status nginx

# Inspect loaded, active, and failed state.

Check if service is active
systemctl is-active nginx

# Return a simple active state.

Check if service is failed
systemctl is-failed nginx

# Return failure state for a unit.

## Enable, Disable, Mask
Enable on boot
sudo systemctl enable nginx

# Enable a unit to start automatically.

Disable on boot
sudo systemctl disable nginx

# Disable autostart for a service.

Enable and start
sudo systemctl enable --now nginx

# Enable service at boot and start it now.

Disable and stop
sudo systemctl disable --now nginx

# Disable service at boot and stop it now.

Mask a service
sudo systemctl mask nginx

# Prevent a unit from being started.

Unmask a service
sudo systemctl unmask nginx

# Remove masking from a unit.

Check if enabled
systemctl is-enabled nginx

# Show whether the service starts at boot.

## List and Inspect Units
List loaded units
systemctl list-units

# Show active loaded units.

List service units
systemctl list-units --type=service

# Filter unit list to services.

List all service unit files
systemctl list-unit-files --type=service

# Show loaded and unloaded service files.

List failed units
systemctl --failed

# Show units in failed state.

Show low-level unit properties
systemctl show nginx

# Dump detailed properties for a unit.

Show one property
systemctl show nginx -p ActiveState -p SubState

# Read a specific unit property.

Print unit file and drop-ins
systemctl cat nginx

# Show the unit definition actually used by systemd.

Show documentation paths
systemctl status sshd

# Print the unit's help and docs references.

## Dependencies and Targets
List dependencies
systemctl list-dependencies nginx

# Show dependency tree for a unit.

List reverse dependencies
systemctl list-dependencies --reverse network-online.target

# Show units depending on a unit.

Show default target
systemctl get-default

# Display the default boot target.

Set default target
sudo systemctl set-default multi-user.target

# Change the default boot target.

Switch to a target now
sudo systemctl isolate rescue.target

# Immediately isolate a target.

## Daemon Operations
Reload systemd manager config
sudo systemctl daemon-reload

# Reload unit files after changes.

Reexecute systemd
sudo systemctl daemon-reexec

# Ask PID 1 to reexec itself.

Reset failed state
sudo systemctl reset-failed

# Clear failed markers for units.

Reload systemd and a service
sudo systemctl daemon-reload && sudo systemctl restart myapp

# Common flow after unit edits.

## Shutdown and Reboot
Reboot system
sudo systemctl reboot

# Reboot through systemd.

Power off system
sudo systemctl poweroff

# Shut down and power off.

Halt system
sudo systemctl halt

# Stop the CPU without powering off on some platforms.

Enter rescue mode
sudo systemctl rescue

# Switch to rescue target.

Enter emergency mode
sudo systemctl emergency

# Switch to emergency shell target.

More in Linux systemd Services

No other published sheets yet.

Recommended next

No recommendations yet.