Most Linux users, especially admins, depend upon the command line to perform frequent tasks on Ubuntu; one such task is rebooting/restarting your system. We tend to restart our systems for various reasons. One of these reasons is because some software requires rebooting at the end of the installation so that it can become fully operational. Some configuration changes on Ubuntu also require you to restart your system so that the processes are updated accordingly. There is another important reason to reboot your system that we can’t ignore; getting rid of a software glitch. Whenever we restart out system, a fresh copy of the software is loaded into the active memory, getting rid of the malfunctioning one. Now you know why the tech support asks you the infamous question: “Have you tried rebooting your system?”
In this article, we will describe three ways for you to reboot your Ubuntu system through the command line:
- the reboot command
- shutdown command
- the init command
We have run the commands and procedures mentioned in this article on a Ubuntu 18.04 LTS system.
Note: We will be using the Ubuntu command line, the Terminal, in order to explain the use of commands mentioned in this article. You can open the Terminal application either through the system’s Application Launcher search bar or the Ctrl+Alt+T shortcut.
The reboot command
The reboot command is the simplest way to restart your system; in a way that it does not power off and then on during this process. The command usually is used with no further flags/options.
Simply using this command as follows will reboot your Ubuntu then n there:
Or to avoid any message that your system might throw, use it as sudo:
$ sudo reboot
The Shutdown command
The shutdown command is used to shut down your system but if you use the -r flag with it, you can make it restart your system. This is how you would use the command for this purpose:
$ sudo shutdown -r
Furthermore, you can set a scheduled reboot of your system through the following command:
$ sudo shutdown -r +[timeInMinutes]
For example, the following command will reboot your system after 10 minutes:
$ sudo shutdown -r +10
You can also set your system to reboot at a specific time as follows:
$ sudo shutdown -r HH:MM
For example, the following command will reboot my system at 4:15 pm
$ sudo shutdown –r 16:15
If you want to cancel this scheduled reboot, run the following command in your Terminal:
$ shutdown -c
The init command
The init command can be used as follows in order to restart your system:
$ init 6
The number that you use with the init command, from 0 to 6, controls the behavior of your system. This behavior and the corresponding actions are called run levels. This is what these number and the corresponding run levels indicate:
0 -Power off the machine
1 – Enter rescue mode
2,3,4,5 – Start runlevelX.target unit
So these were 3 ways for you to reboot your Ubuntu system from the command line. The reason for presenting all these ways was that if one of them does not work for any reason, you have other ones to choose from.