Managing services is one of the main tasks of Linux system administrators. Knowing how to manage system services is also important for Linux users as they may have to deal with services one way or another.
This guide explains how to use the systemctl command to manage systemd services.
What is systemd
Systemd is a system and service manager for Linux operating systems. It is the standard service manager in many Linux distributions, including Ubuntu, Red RHEL, OpenSuse, and Arch Linux. Systemd is a successor to older service managers like System V and Upstart.
In contrast to the System V Service Manager, systemd wants to work more efficiently by starting services in parallel to speed up the Linux startup process. Another unique feature of systemd is that it provides services on demand; H. Can postpone the start of a service only when the system needs it, which greatly improves performance.
Systemd is not limited to just managing operational processes or services, it can also be used for mounting file systems, monitoring networks, running timers, and more.
Managing systemd services with systemctl
On Linux this is systemctl The command is responsible for managing the systemd services. If you have / usr / lib / systemd Directory on your system, then you are most likely using the systemd service manager.
You can also run one of the following commands to check if the systemd service manager is available on your system.
Check the status of a service
Use the option to check the status of a specific service on your system status Command followed by the name of the service you want to check.
For example, to check the status of the docker Service you can run the following command. Docker is a modern virtualization program that software developers use to create applications efficiently.
systemctl status docker
Note: The systemctl help manual refers to the verb after systemctl Therefore, this manual will also adhere to this definition as a command to ensure consistency.
In addition to listing the status of the service, the status The command also includes vital information such as the service's process ID, memory usage, and a simple listing of recent changes in the service.
Knowing the status of a service is one of the most important ways you can troubleshoot or diagnose problems. Before system administrators go into the details of why something is not working, they usually check that the service is running first.
Listing Services With systemctl
Often times, you need to know what services are available on your system before you can continue with their administration. The following command can be used to list all of the available services on your system.
systemctl list-unit-files –type service –all
The command not only lists the services available on your system, it also shows the status of those services. The most common states are; enabled, disabled, masked, etc.
Starting and stopping services
The stop The command is used to stop a service that you no longer want to run. For example, to stop them docker Service:
systemctl stop docker
There are several reasons for shutting down services on your Linux computer. Unused services consume unnecessary system resources and affect the performance of your PC.
When a service is consuming too much memory, consider other options for managing memory on Linux. Running multiple services is also a potential security risk because you open up more ports for outside use.
Use the option to start a service that is not running begin Command. For example, to start the docker Service you recently discontinued:
Start Systemctl Docker
If you want to stop a service and start it again immediately, you can use that start anew Command as follows.
Restart Systemctl Docker
Activate and deactivate services
The conditions Activate and Starting Services are often confusing to some Linux users. When you enable a service, you are saying to make the service available when the system starts, or to provide a service when certain hardware is connected. How to enable the Docker service on Linux:
systemctl enable Docker
To prevent a service from starting at boot time, you can use the deactivate Command. For example, type the following command to turn this off docker Service.
Deactivate systemctl Docker
There are many other commands and options that you can use to manage services on your system. Run the help command systemctl –help or see the systemctl man pages if you are confused about the command.
Sometimes some services start when the system is started. When these services are not required by the system, they affect the overall performance of the computer. You can easily stop such startup services and daemons on Linux.
How to Control Linux Boot Services and Daemons
Linux runs many applications "in the background" that you may not be familiar with. Here's how you can take control of them.
About the author
(10 articles published)
Mwiza is a professional developer of software and writes extensively on Linux and front-end programming. Some of his interests include history, economics, politics, and enterprise architecture.
By Mwiza Kumwenda
Subscribe to our newsletter
Sign up for our newsletter to receive tech tips, reviews, free e-books, and exclusive offers!
One more step …!
Please confirm your email address in the email we just sent you.