How to start, restart and stop services in Ubuntu

In this article, we cover how to start, restart and stop services in Ubuntu. Services are an integral part of Linux distributions. When we require new functionality, we start a new or already stopped service. In certain cases, we may have to restart services if we have made changes to the configuration file.

Apart from that, the services which we start don’t necessarily start at boot. For that, we need to enable them first. Similarly, to stop a service from starting permanently we need to disable it.

We can manage services through the command-line utility: systemctl.

Note: Following operations require Administrative rights. In case you don’t have the required rights, then contact your System Administrator for assistance.

How to start, restart and stop services in Ubuntu

To start a service:

sudo systemctl start <unit>

For instance,

sudo systemctl start apache2.service

But, that won’t start the service at boot. So, to do so:

sudo systemctl enable <unit>

Stop a service:

sudo systemctl stop <unit>

Restart a service:

sudo systemctl restart <unit>

Disable a service:

sudo systemctl disable <unit>

The disable option would seem the exact opposite to enable. But, that is not so when it comes to their functioning. For now, if we have stopped a service then to disable it permanently we can use disable option.

In conclusion, we have covered here how to start, restart and stop services in Ubuntu.

Additional Info:

The service command-line utility which we used earlier is now just a front-end for the command systemctl. Lastly, it is important to know the current status of a service. This can be done through the status option:

sudo systemctl status <unit>

For instance,

sudo systemctl status apache2.service

Similar Posts