systemd Units & Services

systemd Units

systemd manages the system via units. Unit types include .service, .socket, .target, .mount, .timer.

CommandAction
systemctl start nginxStart now
systemctl stop nginxStop now
systemctl restart nginxRestart
systemctl reload nginxReload config (no downtime)
systemctl enable nginxStart at boot
systemctl disable nginxDon't start at boot
systemctl enable --now nginxEnable and start
systemctl status nginxCurrent state
systemctl is-active nginxactive/inactive
systemctl list-units --type=serviceAll services

Unit files live in /etc/systemd/system/ (admin) and /lib/systemd/system/ (packages). After editing, run systemctl daemon-reload.

$ systemctl enable --now sshd
Created symlink /etc/systemd/system/multi-user.target.wants/sshd.service.
Exam trap: startenable. start runs it now; enable makes it start on boot. You usually want both.