Systemd Unit

  • System resources that Systemd manages

Systemd Unit vs Systemd Service

A Systemd Service is a specific type of unit that represents a system service or daemon. Systemd Unit covers a bigger scope that includes Socket, Mounted File System and IO Device etc.

Systemd Unit management cheatsheet

Refer to this How To Use Systemctl to Manage Systemd Services and Units | DigitalOcean to list, edit and inspect Systemd Unit which is used to manage the Systemd.

Just a side note, systemctl start starts the systemd unit immediately but the system unit isn’t auto started after a reboot. systemctl enable ensures the systemd unit is restarted after a reboot, however it is only started after a reboot.

View the systemd unit configuration

systemctl list-units to find the systemd unit you interested in. Then use systemctl cat <systemd_unit> to view the configuration.

Static Systemd Runtime Unit

  • Systemd Unit stored inside /lib/systemd/system, provided by the OS or packages

Dynamic Systemd Runtime Unit

  • Systemd Unit stored inside /run/systemd/system, reflect the current state of systemd-managed services and resources

Custom Systemd Unit

  • We should place our own Systemd Unit files in /etc/systemd/system/. This can override or extend the default unit files found in Static Systemd Runtime Unit without directly modifying the default unit files provided by the OS or packages.


Systemd caches the systemd config files. When we make edits or add in new systemd config files. We should call systemctl daemon-reload to take in the changes.


Here are some example: Shadowsocks service & HashiCorp Vault service

Systemd Log

Systemd Log export & backup

You can use journalctl -u shadowsocks --since "2024-04-12 00:00:00" --until "2024-04-13 00:00:00" -o cat > shadowsocks_2024-04-12.log to export the logs of a system unit collected from 2024-04-12 00:00:00 to 2024-04-13 00:00:00 into a file called shadowsocks_2024-04-12.log. The you can use RCLONE to backup the file to a cloud storage.