How to Start, Stop and Restart Services in Debian 10

You have a services window in the Windows operating system through which you can manage your entire services including viewing, starting, and stopping them. Similarly, you have a terminal in Linux (Debian) operating systems for doing the same.

In this article, I am going to focus on different ways of starting, stopping and restarting the services in Debian version 10.

How to list all services in Debian 10

If you want to view the entire services running in the Debian 10, you can run the following command.

ls /etc/init.d/

Get a list of services in Debian 10

If you want to get a more detailed list of all services and processes running in your Debian operating system, execute the following command.

systemctl list-unit-files

Using systemctl command to list services

You are required to run the above commands with root privileges otherwise you will have an error as shown in the following screenshot.

Execute commands as root

How to check the status of a particular service using init.d

There are several ways to check the status of a particular service whether it is running or not. One of such methods is by using init.d. You can execute the command with root privileges having following syntax,

/etc/init.d/{servicename} status

Let’s check the status of the networking service. The complete command should look like the following,

/etc/init.d/networking status

Get the status of a service

It is clearly visible from above that the networking interfaces are active.

How to check the status of a particular service using systemctl

One of the second methods of checking the status of a particular service is by using systemctl. Syntax of the command is as follows,

systemctl status {servicename}

We will again take the example of a networking service to check its status. For this, execute the following command with root privileges on Debian the terminal.

systemctl status networking

Get service status using systemd

When results are returned, they clearly show that the networking service is running and interfaces are up.

How to stop, start and restart a particular service

There are two methods of stopping and starting a particular service. I will list here both of the methods.

Start and stop a service using init.d

Let me start by stopping the already running networking service to show you how to stop any service with the help of init.d. Execute the following command with root privileges,

/etc/init.d/networking stop

Start and stop services using init system

The complete syntax of the command should look like this,

/etc/init.d/{servicename} stop

In order to confirm the status of the networking service, let’s execute the already described command.

/etc/init.d/networking status

get the status of networking service

The above screenshot shows the networking service is not running and interfaces are inactive.

Once the networking service has been stopped, let us start it to show you the method of starting any service. A command should look like the following,

/etc/init.d/networking start

Restart a service

Therefore, the syntax of the command should be as follows.

/etc/init.d/{servicename} start

Let us confirm that the networking service has successfully run. Therefore, take a status.

/etc/init.d/networking status

Service status after restart

We have successfully run the networking service as the above screenshot shows.

Start and stop a service using systemctl

Services can be started and stopped with the help of systemctl. Let us stop the already running networking service. Execute the following command with root privileges,

systemctl stop networking

The command won’t return any output on the screen. To confirm execute the following command,

systemctl status networking

Start and stop service using systemd and check the status afterwards

The above screenshot clearly shows that the networking service has stopped and network interfaces are inactive.

Once the service has been started, let me start it to show you the method of starting any service. The syntax of the command is as follows,

systemctl start networking

Once the above command is executed successfully, it won’t show anything on the terminal. To make sure that the service has successfully run, check its status with the help of the already described command.

systemctl status networking

Get status of networking service with systemctl command

The output of the command shows that the networking service has successfully run and its interfaces are up.

Restart a service using init.d and systemctl

You can directly restart any service with the help of init.d and systemctl. The syntax of both commands should be as follows,

/etc/init.d/{servicename} restart

systemctl restart {servicename}

To restart the networking service, the above commands should look as follows.

/etc/init.d/networking restart
systemctl restart networking

When these commands are executed successfully, they won’t return anything on the terminal. You can confirm from their status after looking for active and time stamp in the command output.

Restart a service using init.d and systemctl

I hope you have enjoyed this article. If you have any problem or suggestion, please let me know by writing in the comment section.