Similar to all other operating systems, Linux has services and other processes that run in the background to carry out certain essential functions while the system is running. When the system boots, services start automatically and keep running in the background until the system is shut down. However, you can start, stop, and restart the services manually.

In this article, I will show you different methods to start, stop and restart services in Ubuntu. The article covers systemd, the service command and init scripts.

List all services in Ubuntu

Before we start, I will show you how to get a list of all the services on your computer as we need to know the service name to manage the service.

service --status-all

It will show a complete list of services on Ubuntu.

List services in Ubuntu

Use Systemd to Start/Stop/Restart Services in Ubuntu

You can start, stop or restart services using Systemd systemctl utility. This is the preferred way on current Ubuntu versions.

Open up a terminal window, and enter the following commands. For instance, in this case, I want to start, stop or restart the UFW Firewall service in Ubuntu.

The Syntax is:

sudo systemctl [action] [service name]

To start a service:

sudo systemctl stop ufw

To stop a service:

sudo systemctl start ufw

To restart a service:

sudo systemctl restart ufw

To check the status of service:

sudo systemctl status ufw

Manage services with systemd

Start/Stop/Restart Services with service command on Ubuntu

You can start, stop, or restart services using the service command too. Open up a terminal window, and enter the following commands.

To start a service:

sudo service ufw stop

To stop a service:

sudo service ufw start

To stop a service:

sudo service ufw restart

To check the status of a service:

sudo service ufw status

Manage services with the service command on Ubuntu

Using Init scripts to manage services on Ubuntu

You can start, stop or restart services using init scripts in the /etc/init.d directory. This directory actually consists of various scripts for different services. Init scripts are deprecated since Ubuntu switched to Systemd, so this method will be used only if you have to deal with an old Ubuntu version. Open up a terminal window, and enter the following commands.

To start a service:

/etc/init.d/ufw start

To stop a service:

/etc/init.d/ufw stop

To stop a service:

/etc/init.d/ufw restart

To check the status of service:

/etc/init.d/ufw status

Manage services by using init scripts

That is how you can start, stop, and restart services using different ways without restarting the whole operating system. You can also use these commands in other Linux distributions.

How to Start, Stop or Restart Services in Ubuntu