If you use Linux for any period of time, chances are you will come across systemd and systemctl, but just what are they?
systemd is a system and service manager for Linux operating systems. It serves as the primary initialization (init) system, meaning it is the very first process that starts when the computer boots up (holding PID 1). Its job is to bring up the rest of the system, manage background services (daemons), handle system states, and mount filesystems.
systemctl is the dedicated command-line utility used to interact with and control systemd.
Think of systemd as the engine and manager running behind the scenes, and systemctl as the steering wheel and dashboard you use to command it.
But just how do you use them?
Managing Services
Well, to start with you can list out all the active system services:
systemctl list-units --type=service --state=active
To check if a service is running and see its PID and recent log output:
systemctl status service-name
Starting vs. Enabling
A common point of confusion is the difference between starting/stopping and enabling/disabling:
- Start / Stop: Changes the service’s current state immediately (but won’t persist after a reboot).
sudo systemctl start service-name sudo systemctl stop service-name - Enable / Disable: Tells the system whether to launch the service automatically during boot.
sudo systemctl enable service-name sudo systemctl disable service-name
Restarting and Reloading
- Restart: Shuts down the service and starts it back up.
sudo systemctl restart service-name - Reload: Instructs the service to apply new configuration files without shutting down or causing downtime.
sudo systemctl reload service-name
Inspecting Configuration & Logs
Want to view the configuration files for a service?
systemctl cat service-name
And if you need to read the full log history for that service, you can query systemd’s companion logging tool, journalctl:
journalctl -u service-name
Wrapping Up
Hopefully that’s a good quick spin through the basics of systemd services, and something worth referring back to later.