systemctl means “system control”
The main function of systemctl is to manage daemons.
- Daemon: In the context of Linux and Unix systems, a “daemon” is a program that runs in the background, without direct user interaction. Its purpose is to perform necessary tasks or provide services, such as a web server (httpd or nginx), a database server (mysqld), or a logging service (syslogd). The name comes from Greek mythology, where a “daemon” was a guardian spirit that performed background tasks.
- systemd: This is the startup system and service manager for many major Linux operating systems. It is the first process to run upon system boot (with PID 1), and its job is to start all other processes and services, including daemons. systemd replaced the older SysV init system in most modern distributions.
- systemctl: This is the command-line tool used to interact with systemd. It’s the interface that allows you to control, manage, and view the status of the services managed by systemd.
It is the primary command-line tool for interacting with the boot system and service manager, used in most modern Linux distributions.
I’m writing this post for myself because every now and then I look for the same commands.
systemctl allows you to monitor and manage services, drives, and overall system status.
systemd is the system that manages background processes (daemons), and systemctl is the tool you use to communicate with and control systemd.
When you create a .service file for systemd, what you’re actually doing is defining a “service” that systemd can manage. That service almost always runs a program that behaves like a daemon.
With it, you can:
- Start, stop, restart, or reload services.
- View the status of services.
- Enable or disable services to start automatically at boot.
It is the command that replaced older system startup tools like SysVinit, service, and chkconfig.
Start a service
systemctl start [service]
Stops a service
systemctl stop [service]
Restart a service
systemctl restart [service]
Displays the current status of the service, including whether it’s up, down, or failed, and the latest lines of its log. This is very useful for diagnosing problems.
systemctl status [service]
Enables a service to start automatically every time the system reboots.
systemctl enable [service]
Disables a service from starting at system startup
systemctl disable [service]
Checks whether a service is enabled or disabled
systemctl is-enabled [service]
Displays a list of all active services on the system
systemctl list-units --type=service
Reloads the systemd configuration to apply changes to service unit files
systemctl daemon-reload
create your own service
It is a common practice to automate the execution of scripts or programs at system startup or to manage them more efficiently.
You can create and manage your own custom services to automate tasks on your Linux system.
To do this, you need to create a unit file (.service) that describes how your service should run. This file is a simple text file with a specific structure.
Create the unit file
User service files are stored in the /etc/systemd/system/ directory.
You need administrator (sudo) permissions to create files in this location.
for example:
sudo vi /etc/systemd/system/mi-own-service.service
defines the contents of the unit file
[Unit]
Description=Mi first service of systemd
After=network.target
[Service]
User=your_user
ExecStart=/path/to/your/script.sh
Restart=on-failure
[Install]
WantedBy=multi-user.target
Explanation of the sections
- [Unit]: Contains metadata and dependencies.
- Description: A brief description of your service.
- After: Specifies that your service should start after the conditions of another unit, such as network.target (ensuring the network is up), are met.
- [Service]: This is where you define how the service runs.
- User: The system user that will run the service. It’s good practice not to use root unless necessary.
- ExecStart: The full path to the script or program you want to run.
- Restart: Defines the restart policy. on-failure restarts the service if it fails. Other options are always or no.
- [Install]: Defines how the service integrates into the system.
- WantedBy: The “target” or “runlevel” under which this service should be started.
- multi-user.target is the standard target for most services on a Linux system.
Reload the systemd daemon:
Once you’ve saved the file, you must inform systemd about the new service so it can recognize it.
sudo systemctl daemon-reload

systemctl manages systemd using commands, systemd manages services and some of them are daemons
Below are images detailing its operation





The use of the letter “d” at the end of a program name is a naming convention indicating that it is a daemon. The “d” is simply short for “daemon.”
Here are some of the most well-known examples:
- sshd: The daemon that manages SSH connections.
- httpd: The Apache web server daemon.
- crond: The daemon responsible for running scheduled tasks (cron jobs).
- systemd: The main daemon that manages the startup and administration of all services.
- mysqld: The MySQL database server daemon.
Although this is a widespread convention, it’s not a strict rule. There are daemons that don’t follow this pattern, such as nginx, a popular web server that also functions as a daemon but doesn’t have the ‘d’ at the end.