{{< partial "learn_x_header" >}} ## The Basics The systemctl command on [most Linux distributions] controls the systemd system and service manager. I'm writing this article to explain systemctl and journalctl. I've used [the service command, but it has gone out of style. It's time for an update. Without [systems,] the systemctl and journalctl commands would not exist. The systemd software suite aims to unify service configuration and behavior across systems. It's worth noting that people dislike systemd because it enables tight couplings between software packages and systemd. ### Primary Use Cases * Managing services on Unix systems * [Container manager interface] ### Less Suitable Use Cases {#2-invalid-use-cases} * A dependency required to run your software ### When to Use systemd? Use systemd when you need to manage services on Unix systems. It's the standard for service management on most Linux distributions. ## Common Commands ```sh # List all services sudo systemctl list-units --type service # List running services sudo systemctl list-units --type=service --state=running # List active services sudo systemctl list-units --type=service --state=active # List failed services sudo systemctl list-units --state failed # Get the status of a service sudo systemctl status containerd # Stop a service sudo systemctl stop containerd # Start a service sudo systemctl start containerd # Restart a service sudo systemctl restart containerd # Check if a service is enabled systemctl is-enabled containerd # Check if a service is active sudo systemctl is-active containerd # Disable a service is active systemctl disable containerd # Check service logs for current boot sequence journalctl -u service-name -b # Check service logs journalctl -u containerd # Tail service logs journalctl -u containerd -f ``` ## Learn systemd - Beyond the Basics * [systemctl manpage] * [journalctl manpage] * [Linux Service Management Made Easy with systemd] ## Related Content * [How to List Services in Linux] * [Linux: Why do people hate systemd?] * [Create a simple systemd service unit file and run a script on boot] [most linux distributions]: https://en.wikipedia.org/wiki/Systemd#:~:text=Since%202015%2C%20the%20majority%20of,V%20and%20BSD%20init%20systems. [systems,]: https://en.wikipedia.org/wiki/Systemd [container manager interface]: https://systemd.io/CONTAINER_INTERFACE/ [systemctl manpage]: https://man7.org/linux/man-pages/man1/systemctl.1.html [journalctl manpage]: https://man7.org/linux/man-pages/man1/journalctl.1.html [linux service management made easy with systemd]: https://www.amazon.com/Linux-Service-Management-Made-systemd-ebook/dp/B09D3VHLD2/ref=sr_1_4?crid=224V1I2YB4ZKP&keywords=systemd&qid=1636076593&qsid=130-1968788-0674114&sprefix=systemd%2Caps%2C135&sr=8-4&sres=1593272200%2CB078951MG4%2C1642350133%2CB09D3VHLD2%2CB001M5KMUK%2CB001M5HOJW%2CB08W5B98F3%2C1718500408%2C0134277554%2C1593279523%2C1593275676%2CB07SV1JJRG%2CB08DKJHDBY%2CB07MFK4QML%2CB004GAHO1I%2C1119096723%2CB0946SYRRW%2C1492087165%2CB07ZQHX3R1%2CB077GT62XX [how to list services in linux]: https://www.howtogeek.com/839285/how-to-list-linux-services-with-systemctl/ [linux: why do people hate systemd?]: https://www.infoworld.com/article/3159124/linux-why-do-people-hate-systemd.html [create a simple systemd service unit file and run a script on boot]: https://www.suse.com/support/kb/doc/?id=000019672