Services are the applications that run in the operating system's background waiting to be used. Linux lets you see and manage these services and overall offers more control over them.
Systemctl is a controller or utility of Systemd(is an init system with compost for a set of programs executed in the background), with auxiliary in manage services, these commands are executed in mode root if you aren’t mode root the system, requesting the password of root.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Systemd queries on Linux System.
In this context, we shall look into methods to start, stop and restart any service in Linux Mint 20.
Before proceeding with this configuration task, ensure that you are using a user account with root / sudo privileges, access to the terminal, and the systemctl tool which comes with Linux.
Systemd is itself a daemon which refers to libraries, packages, and utilities around daemons. It is the most advanced system management daemon that is fast and takes much fewer system resources than its counterparts.
1. View All Services
You can see all the available services in your system with the following command:
$ sudo systemctl list-unit-files --type=service
2. View Running Services
To see all the services that are currently running on your system, run the following command:
$ sudo systemctl | grep running
3. Start a Service
Use the following command to start your service:
$ sudo systemctl start <service name>
Note: Remember <service name> is a placeholder and you need to replace it with the name of your service.
4. Stop a Service
Use the following command to stop your service:
$ sudo systemctl stop <service name>
5. Restart a Service
Use the following command to restart your service:
$ sudo systemctl restart <service name>
6. Check Status of the Service
Use the following command to check the status of your service:
$ sudo systemctl status <service name>
Service is an advanced command that is a part of init. But its execution is done now by redirecting commands to systemctl.
1. View All Services in Your System
To check all the services you have on your system, simply run the command below:
$ sudo service --status-all
Note that all the enabled services are preceded by the [+] symbol while all the disabled services have the [-] symbol next to them.
2. Start a Service
You can start a service using the following command:
$ sudo service <service name> start
3. Stop a Service
To stop a service, use the following command:
$ sudo service <service name> stop
4. Restart a Service
Restart any service with the following command:
$ sudo service <service name> restart
5. Check Status of the Service
You can check the status of any service with the following command:
$ sudo service <service name> status
The init daemon is a daemon management system referred to as System V init. It takes a lot of resources so it was replaced by systemd.
1. Start a Service
Start service with the following command:
$ sudo /etc/init.d/<service name>start
2. Stop a Service
To stop a service, run the following command:
$ sudo /etc/init.d/<service name> stop
3. Restart a Service
To restart a service, run the following command:
$ sudo /etc/init.d/<service name> restart
4. Check Status of the Service
Check the status of a service using the following command:
$ sudo /etc/init.d/<service name> status
This article covers the basics of service management in Linux Mint 20. Linux provides fine-grained control over system services through systemd, using the systemctl command. Services can be turned on, turned off, restarted, reloaded, or even enabled or disabled at boot.
The basic syntax for using the systemctl command is:
$ systemctl [command] [service_name]
Typically, you'll need to run this as a superuser with each command starting with sudo.
How to Restart a Service ?
To stop and restart the service in Linux, use the command:
$ sudo systemctl restart SERVICE_NAME
After this point, your service should be up and running again. You can verify the state with the status command.