How to Restart Services from Linux Terminal
From this article, you will learn how to restart services in the Linux. This can be done with a few simple commands in any Linux distribution.
Open the Terminal. Most Linux distributions have a menu (in the lower left corner of the screen) in which the Terminal application is located. A Terminal is an analog of the Windows command line.
The user interface depends on the Linux distribution, so you may have to find the Terminal application inside one of the menu folders.
On some Linux distributions, the Terminal is displayed at the top or bottom of the screen.
Type the command to display a list of all active services.
Type ls /etc/init.d in the Terminal and press Enter.
Then you will see the list of running services and the corresponding command names.
Find the name of the service you want to restart.
Typically, the name of the service (for example, “Apache“) is displayed on the left side of the screen, and the name of the command (for example, “httpd” or “apache1” depending on the Linux distribution) is on the right side of the screen.
Type the command to restart the service.
Enter sudo systemctl restart service in the Terminal, where substitute the name of the service command for the service, and then press Enter.
For example, to restart Apache on Ubuntu, type sudo systemctl restart apache1 in the Terminal.
Enter the password when prompted.
Enter the superuser password, and then press Enter.
The service will be restarted.
If the service does not restart, type sudo systemctl stop service, press Enter, and then type sudo systemctl start service.
With the “chkconfig» command you can add and remove the service from the autorun.
To see a list of all active services, enter ps -A in the terminal.
Do not stop services that you do not know.
Remember that some services are necessary for stable operation of the system.