Updated April 14, 2023
Introduction to Linux restart
Linux restart is defined as a command which enables users to reboot or restart a Linux system. This utility is purposefully required when there is a need for a system to post some major updates like network or drivers. The reason for restarting is to make sure that all the supporting applications are closed so that proper effect takes place uniformly throughout the system and the server. This term is about the system restart, but it also takes care of the restart of the process running in the system. In this article, we would go through some of the methods in restarting the Linux system and processes running in Linux.
Syntax
In Linux, there are a lot of options available for Linux restart utilities, and in this article, we will go through all the options and will also mention the utilities of each of the options we have and the scenario they would work the best. But before that, let us look at the syntax of the command line commands before we move on to the different ways of performing the task.
Restarting the Linux system
1. Using the systemctl command
Syntax
sudo systemctl start reboot.target
2. Using the shutdown command
Syntax
sudo shutdown -r now
3. Using the reboot command
Syntax
sudo reboot
4. Using the init command
Syntax
sudo telinit 6
Restarting the Linux process
1. Using the systemctl command
Syntax
sudo systemctl restart <process name>
2. Using the service command
Syntax
sudo service httpd restart
How to restart Linux using various methods?
In this section, we will look at the different methods available for restarting Linux. Firstly, we will discuss the methods that are used for restarting Linux. For all of our readers, it is interesting for you to know the subtle difference between restart and reboot. There is a very thing line of difference between them and, hence, very important to understand if one wants to use the words interchangeably. The words reboot can be broken down into 2 sub-words, i.e. re and boot. Now the intention behind reboot is to fix a problem which is happening and can be sorted if the system boots again, whereas restart doesn’t have any intention behind the scene, although the process remains unchanged. Hence, we would treat reboot and restart as same from a process standpoint for any purpose in this article.
Now coming to the methods in restarting the system. In the first one, we can use the Linux UI, which might vary as per the distribution installed. Here we would need to go to the application menu and from there need to select the option of the power button. In the same, there might be multiple options present, one of which is to reboot or restart the system. Clicking on that button will automatically shut down the system and restart it again. The second option is by pushing the physical button. Pressing that button present in the system will display you an option to shut down or restart. Select the option of a restart to proceed with the option. Sometimes a user might operate on a terminal rather than a GUI and hence would find using the CLI way more efficient, and hence next few options shows exactly those. The third option is to run the systemctl command.
The reboot or the power of processes are taken care of by the init system, and the system in Linux is the init system. Using the systemctl command will allow the system to accept the reset signal and act accordingly. The fourth option is to run the shutdown command. There are various options available, and one of them is the -r option, which wills end the signal to the OS to restart the system. The fifth option is to run the reboot command. This command is nothing but a shortcut to the earlier command fulfilling the utility of the restart. The sixth and the final is by using the telinit command, which reserves a number for a restart, and once that option or number, i.e. 6, is invoked, the signal is automatically sent to the OS to take its course.
Now coming to the other part of restarting the process. The first option is to use the systemctl command. Here one can look at the subtle difference which lies in between restarting the system and restarting the process, which is explained in the syntax. The second option is to use the service command; the chronology is a bit different from the systemctl command and used in a legacy system. To our surprise, this command still works in the latest distributions.
Though in this article we have talked about most of the methods that are possible in Linux operating systems, it doesn’t mean that we have discussed all. Some of them include hard restart or reboot as well. The hard restart comes under irresponsibly restarting the system because these methods keep a chance to damage the system.
Examples of Linux restart
Here are the following examples mention below
Example #1
Restarting the Linux system:
Using the systemctl command
Syntax
systemctl start reboot.target
Output:
Example #2
Using the shutdown command
Syntax
shutdown -r now
Output:
Example #3
Using the reboot command
Syntax
sudo reboot
Output:
Example #4
Using the init command
Syntax
sudo telinit 6
Output:
Example #5
Restarting the Linux process:
Using the systemctl command
Syntax
sudo systemctl restart httpd
Output:
Here in this scenario, we don’t have an output, but this command would let you restart the process named httpd and then return to the bash prompt. In place of httpd, you can input any of the other process you want to!
Example #6
Using the service command
Syntax
sudo service httpd restart
Output:
Conclusion
With the discussed set of examples and explanation of the way of working for restart, we can get a sense of the utility the each of the methods possesses. Now it remains on the reader’s shoulders to try out all the methods we have discussed in this article and keep experimenting every day to learn more. So lastly, just to sum things up, we would like to mention that one should act responsibly while it comes to system restart.
Recommended Articles
We hope that this EDUCBA information on “Linux restart” was beneficial to you. You can view EDUCBA’s recommended articles for more information.