Restarting a service is one of the administrative tasks that you will have to perform one time or the other while configuring software on your Ubuntu. In this article, we will explain how to restart a running service on your Ubuntu through the systemctl command. We will also explain some more service management systemctl commands that will help you further while working with services.
We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.
In this article, we will be using the Ubuntu command line, the Terminal, in order to explain how to restart a running service.
You can open the Terminal application on your Ubuntu either through the application launcher search bar or simply through the Ctrl+Alt+T shortcut.
The latest versions of Ubuntu use systemd to control and start services. To get a list of all enabled systemd units, run this command:
systemctl list-unit-files | grep enabled
The list will help you in fetching the exact service name that you can later use to restart the service.
You can use the systemctl command in order to restart a service. This command is a relatively new tool that you can use to control systemd (init system) and services. This tool is the replacement of the sysV init manager. These days, most modern Linux distros have switched to systemd and thus systemctl.
Here is how you can use the systemctl command in order to restart a running service:
$ sudo systemctl restart [servicename]
For example, the following command can be used to restart the UFW( Uncomplicated Firewall) service on Ubuntu:
$ sudo systemctl restart ufw
Please note that you need to be an authorized user in order to manage system services.
Not only you can restart services with systemctl, but you can also:
$ systemctl status [servicename]
$ systemctl start [servicename]
$ systemctl stop [servicename]
$ systemctl reload [servicename]
$ sudo systemctl reload-or-restart [servicename]
$ systemctl enable [servicename]
$ systemctl disable [servicename]
$ sudo systemctl is-active [servicename]
$ sudo systemctl is-enabled [servicename]
Through this simple, yet useful tool you can restart a service without having to restart your entire system. Not only that, you can perform more service management with the help of the command usage described in this article.
Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…
ISPConfig is an open-source control panel that allows users to manage multiple servers from a…
As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…
Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…
Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…
phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…