Skip to content
ohsudo, Home
Linux

systemctl and journalctl Cheat Sheet

Manage Linux services and read their logs: start, stop, enable, status, failed units, overrides, timers, and filtering journalctl by unit, time and priority

Updated November 6, 2026 · Applies to Ubuntu · Debian · RHEL / Rocky / AlmaLinux · systemd 245+

Services

Terminal window
systemctl status nginx # state, recent log lines
sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx # stop, then start
sudo systemctl reload nginx # re-read config, without a restart
sudo systemctl reload-or-restart nginx

At boot

Terminal window
sudo systemctl enable nginx # start at boot
sudo systemctl enable --now nginx # and start it now
sudo systemctl disable nginx
sudo systemctl disable --now nginx # and stop it now
systemctl is-enabled nginx
sudo systemctl mask nginx # forbid it from starting at all
sudo systemctl unmask nginx

enable doesn’t start anything until the next boot, and start doesn’t survive one. You usually want both, which is enable --now.

What’s running, and what failed

Terminal window
systemctl --failed # what failed?
systemctl list-units --type=service # loaded services
systemctl list-units --state=running --type=service
systemctl list-unit-files --type=service # all, with enabled/disabled
systemctl is-active nginx # for scripts
sudo systemctl reset-failed nginx # clear a "failed" state
systemctl status 812 # which unit does this PID belong to?

Change a unit

Terminal window
systemctl cat nginx # the unit, and every override
systemctl show nginx -p Restart,User,ExecStart # effective settings
sudo systemctl edit nginx # add an override (survives upgrades)
sudo systemctl edit --full nginx # edit a full copy
sudo systemctl revert nginx # remove your overrides
sudo systemctl daemon-reload # after changing a unit file by hand

Unit files you write go in /etc/systemd/system/. The systemd Unit Generator writes them for you.

Machine state

Terminal window
systemctl is-system-running # running, or degraded?
systemctl get-default # multi-user or graphical?
sudo systemctl reboot
sudo systemctl poweroff
systemd-analyze blame # what made boot slow?
systemd-analyze verify myapp.service # check a unit for mistakes

Timers

Terminal window
systemctl list-timers --all # when did each run, and when's next?
sudo systemctl enable --now backup.timer
sudo systemctl start backup.service # run the job now
journalctl -u backup.service -n 50
systemd-analyze calendar 'Mon *-*-* 03:00' # check a schedule

Read logs

Terminal window
journalctl -u nginx # one service
journalctl -u nginx -f # follow
journalctl -u nginx -n 50 --no-pager # last 50 lines, for pasting
journalctl -xeu nginx # the end, with explanations
journalctl -b # since this boot
journalctl -b -1 # the previous boot
journalctl -k # kernel messages only

Filter logs

Terminal window
journalctl --since "1 hour ago"
journalctl --since "2026-11-06 09:00" --until "2026-11-06 10:00"
journalctl --since today -u nginx -u php8.3-fpm # several units
journalctl -p err -b # errors and worse, this boot
journalctl -g 'timed out' -u nginx # search by text (a regex)
journalctl _PID=812 # one process
journalctl -o json-pretty -n 1 # every field of one entry
journalctl -o cat -u nginx # only the messages

Priorities, from worst: emerg, alert, crit, err, warning, notice, info, debug.

Log disk space

Terminal window
journalctl --disk-usage
sudo journalctl --vacuum-size=500M # shrink to 500 MB
sudo journalctl --vacuum-time=14d # keep two weeks

To set a lasting limit, use SystemMaxUse=500M in /etc/systemd/journald.conf, then sudo systemctl restart systemd-journald.

Your own user’s services

Terminal window
systemctl --user status myapp
systemctl --user enable --now myapp
journalctl --user -u myapp
sudo loginctl enable-linger alex # keep them running after logging out

Common errors

Practice these

A guided lesson, in your browser: Services: systemctl and journalctl.