It may be necessary to restart a service on a Linux operating system after modifying some of its parameters so that they are taken into account immediately after the changes. It is not necessary to completely restart the system.
Step 1. Open a command terminal
Most Linux distributions have a button titled Menu in the lower left part of the screen, where you will find the Terminal application. Select this application to start the terminal. Alternatively, you can simultaneously type Ctrl + Alt + T from your desktop to save time.
- Some Linux distributions change their appearance between two versions. You may also have to search for the command terminal app in a specific folder on their start menu.
- Sometimes you can also find the terminal on the desktop and more frequently in the task bar located at the bottom of the screen, very close to the menu button.
- Some Linux distributions also have a command line entry bar at the top or bottom of the screen.
Step 2. View the services currently running
Enter the command ls /etc/init.d in your terminal then press the Enter key. The list of running services will be displayed in the terminal, showing you the names corresponding to their command. Note that on recent versions of Ubuntu and its derivatives, you will only see the service name display.
If you don't get any results, try the ls /etc/rc.d/ command instead
Step 3. Find the script name of the service to restart
On some distributions, the name of the service (for example Apache), will be displayed in the left column of the terminal, while the name of the corresponding script (in this case, httpd Where apache2) will be listed in the one on the right.
Step 4. Issue the restart command
Type sudo systemctl restart service in your terminal, replacing the part of the command corresponding to service by the name of the script managing this service, then press the Enter key.
To restart the Apache server under Ubuntu Linux, you will need to enter sudo systemctl restart apache2 in your terminal. See also this method for the most recent versions of Ubuntu and its derivative distributions
Step 5. Enter your password
At the system prompt, enter the password used to access the superuser level, and then press the Enter key. This will restart the Apache service.
If the service did not restart using this command, try stopping it by typing sudo systemctl stop service, press Enter, and then reissue the sudo systemctl start service command
- You can use the command chkconfig to add or remove services when your system starts up. Note that this utility is not automatically installed on all Linux distributions.
- Enter the command ps -A in your terminal to view the complete list of services running in all directories on your computer.