systemd and journalctl cheatsheet

systemd and journalctl: Managing services

12 common systemd and journalctl tasks.

Check a service

Show whether a service is running, with its latest log lines.

systemctl status nginx

Start a service

Start a service right now.

sudo systemctl start nginx

Stop a service

Stop a running service right now.

sudo systemctl stop nginx

Restart a service

Stop and start a service.

sudo systemctl restart nginx

Reload a service's configuration

Ask a service to reload its configuration without restarting, if it supports that.

sudo systemctl reload nginx

Start a service now and at boot

Enable a service for boot and start it immediately.

sudo systemctl enable --now nginx

Stop starting a service at boot

Disable a service from starting at boot. Add --now to also stop it.

sudo systemctl disable nginx

Test if a service is running

Print active or inactive; the exit code suits scripts.

systemctl is-active nginx

List failed units

Show units that have failed.

systemctl --failed

List running services

Show all service units that are loaded and running.

systemctl list-units --type=service --state=running

Prevent a service from starting

Link the unit to /dev/null so nothing can start it, even manually.

sudo systemctl mask nginx

Caution: A masked service can't be started until you unmask it.

Manage your own user services

Use the per-user service manager, with no sudo.

systemctl --user status myapp

Was this page helpful?