systemd cheat sheet
Basics
Systemd is a system and service manager. It is replacing older init systems and running Process ID (PID) 1, managed by the kernel itself.
Want to learn more? Have a look at the systemd section.
Systemd information
Command | Performed action |
---|---|
systemctl get-default | Show default target (like run level) |
systemctl list-automounts | Show automounts |
systemctl list-dependencies | Show dependencies of an unit or default target |
systemctl list-jobs | View active jobs |
systemctl list-sockets | List sockets and what it activates |
systemctl list-timers | List timers (scheduled tasks, similar to cronjobs) |
systemctl list-unit-files | Show unit files and state |
systemctl list-units | Show if units are loaded/active |
Basics for services
Stop and start
Command | Performed action |
---|---|
systemctl stop | Stop running service |
systemctl start | Start service |
systemctl restart | Restart running service |
systemctl reload | Reload config files for service |
Status and unit changes
Command | Performed action |
---|---|
systemctl daemon-reload | Reload changed unit files |
systemctl status | Show status of service |
systemctl state=failed (or --failed) | Show failed services |
systemctl reset-failed | Resets unit(s) with failed state |
systemctl enable | Enable service or unit and allow start on boot |
systemctl disable | Disable service or unit, don’t start at boot |
systemctl mask | Fully disable a unit |
systemctl unmask | Reactivate unit again after being masked |
Configuration
Command | Performed action |
---|---|
systemctl cat | Show unit file details |
systemctl show | Show properties |
systemctl edit | Create configuration as drop in unit (extension to primary config) |
systemctl edit --full | Edit primary unit file for service |
» Mastering the tool: systemctl
systemctl cheat sheetJournal
Instead of a log files, systemd stores logging information in journals.
Long option | Short option | What the option does |
---|---|---|
--follow | -f | Track changes, like tail -f |
--output= | -o | Define what output format should be used for journal entries |
--reverse | -r | Reverse output, newest on top |
--since | -S | Limit the data to a specific period |
» Mastering the tool: journalctl
journalctl cheat sheetSystem state
The options to change the system state are:
- systemctl reboot
- systemctl poweroff
- systemctl suspend
- systemctl hibernate