Installation | Topics | Beyond Lino

Systemd cheatsheet

Debian adopted systemd in 2015 as the new init system. Systemd is responsible for running different system services.

Manage system services

To start (also stop, restart) a specific systemd service (e.g. nginx):

systemctl start nginx

Enabling and disabling of the aforementioned service:

systemctl enable nginx; systemctl disable nginx

List all possible systemd services in a Linux server:

systemctl list-units --type=service

Display all running systemd services as a tree:

systemctl status

Display the status of some specific service:

systemctl status nginx

journalctl

Closely connected with systemctl is journalctl, the command for inspecting log files.

Get information about some system service:

$ sudo journalctl -xe | grep service_name

To get the log of a Lino site (e.g. “prod”):

$ sudo journalctl -t prod

See how much disk space your log files use:

$ sudo journalctl --disk-usage

To verify file consistency of the journal system:

$ sudo journalctl --verify

To remove all entries older than 2 weeks:

$ sudo systemctl  --vacuum-time=2weeks

Further reading

The main site of systemd with detailed information:

To study more about systemd, there is a freely downloadable book:

3 surprising things Linux sysadmins can do with systemd: