The Linux systemctl command

Windows Articles

How to repair a USB drive in Windows 10.

Hi! USB sticks are undoubtedly very functional elements for working in Windows 10. Indeed, their use ranges from file management to creating...

How to install double-tap on back gesture on your Android

Hi, how are you? The double-tap on back gesture is one of the new functions available on Android 11 and IOS 14....

How to install KVM on Debian 10?

Hello friends, in this post I will show you how to install KVM on Debian 10. KVM stands for...

How to open Windows 10 Mobility Center

Hello! There are many types of users of Windows 10. As it depends on the type of hardware used. That is, the...

Ubuntu 20.04.1 available

Canonical, the company led by Mark Shuttleworth, releases Ubuntu 20.04.1. It has a new image, with updates and security patches for the...
angeloma
angeloma
Senior Writer and partner

In many of our tutorials we have to manage services but what are these services? How are they handled? Well, basically they can be handled with the systemctl command. And in this post, I will teach you how to use the Linux systemctl command. At least so that you can manage the computer services in a fast and basic way.

What is a system service?

A system service is usually an application that runs in the background. That is to say that it is not necessary that they have a constant interaction with the user to be able to work. This concept is vital to any modern operating system. Some of the most essential applications of a server are managed as services, for example, SSH or MySQL.

Well, services are handled in Linux with a command that is systemctl. This is because, since recent versions of the kernel and the main current Linux distributions, Systemd is in charge of managing the services.

So we will see how to use the Linux systemctl command.

The Linux systemctl command

Within our Linux system, the main function of the systemctl command is to administer the system services. Or those applications that are managed as a service.

First, it is a command that requires root privileges to function. This means that either we enable sudo for our user or we will have to be the root user.

How to enable sudo on Debian 10?

How to enable sudo on CentOS 8?

Now, we will be able to list all the services that are in our system, for it uses the following command

:~# systemctl -t list-unit-files --all

It is also useful to list all active services. To do this, just use:

:~# systemctl list-unit

Once we know what the services are, we can work with them.

To start a service that is stopped the syntax is as follows:

:~# systemctl start [service_name]

For example:

:~# systemctl start apache2

To stop it:

:~# systemctl stop [service_name]

Sometimes we make changes to the service and for them to take effect it is necessary to restart it. To do this, we use the following command:

~# systemctl restart [service_name]

However, many of these changes are at the configuration level. In this case, the service has to be recharged.

:~# systemctl reload [service_name]

It is also possible to restart a service that is currently running:

:~# systemctl condrestart [service_name]

And if you want to know the status of a service:

:~# systemctl status [service_name]

This function is quite interesting about the status of the service. Because we will be able to have in detail if a service is running or not. And if at the moment of initiating it gives an error, also with this command we will be able to make the pursuit of him.

If you want a service to run automatically with the system, you can do it with the following command:

:~# systemctl enable [service_name]

If you no longer wish it to be so, reverse it with this other command:

:~# systemctl disable [service_name]

And that is it. I hope this little guide can help you with systemctl.

Conclusion

Using and managing the system’s services on Linux is not a completely simple task, but it is not as difficult as we think. In this sense, systemctl is a relatively simple command that will help us with the management of them.

Please share this post, with your friends and join our Telegram channel.

More articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest article

How to repair a USB drive in Windows 10.

Hi! USB sticks are undoubtedly very functional elements for working in Windows 10. Indeed, their use ranges from file management to creating...

How to install double-tap on back gesture on your Android

Hi, how are you? The double-tap on back gesture is one of the new functions available on Android 11 and IOS 14....

How to install KVM on Debian 10?

Hello friends, in this post I will show you how to install KVM on Debian 10. KVM stands for...

How to open Windows 10 Mobility Center

Hello! There are many types of users of Windows 10. As it depends on the type of hardware used. That is, the...

Ubuntu 20.04.1 available

Canonical, the company led by Mark Shuttleworth, releases Ubuntu 20.04.1. It has a new image, with updates and security patches for the...