Most Linux users, especially administrators, rely on the command line to perform frequent tasks on Ubuntu; one such task is rebooting/rebooting your system. We tend to restart our systems for various reasons. One of these reasons is that some programs require a restart at the end of the installation so that it can be fully operational. Some configuration changes in Ubuntu also require you to restart your system so that the processes are updated accordingly. There is another important reason to restart your system that we cannot ignore; Get rid of a software problem. Every time we restart our system, a new copy of the software is loaded into the active memory, eliminating the malfunction. Now you know why tech support asks you the infamous question, “Have you tried rebooting your system?”
In this article
, we will describe three ways to restart your
Ubuntu system via the command line: the
- reboot command
- shutdown
- init command
command the
We have run the commands and procedures mentioned in this article on an Ubuntu 20.04 LTS system. The commands will also work in the upcoming version of Ubuntu 22.04.
Note: We will use Ubuntu’s command line, the Terminal, to explain the use of the commands mentioned in this article. You can open the Terminal application through the search bar of the system application launcher or the Ctrl+Alt+T shortcut.
The reboot command
The reboot command is the easiest way to restart the system; so that it does not turn off and then turn on during this process. The command is usually used without further flags/options.
Simply using this command in the following way will restart your Ubuntu and then n there
: $ reboot
Or to avoid any message that your system might throw, use it as sudo: $ sudo
restart The
Shutdown command The shutdown command
is used to shut down your system, but if you use the -r prompt with it, you can make it restart your system. Here’s how you would use
the command for this purpose: $ sudo shutdown -r
Also, you can set a scheduled restart of
your system through the following command: $ sudo shutdown -r +[timeInMinutes]
For example, the following command will restart your system after 10 minutes
:
$ sudo shutdown -r
+10
You can also configure your system to restart at a specific time as follows:
$ sudo shutdown -r HH:MM For example, the following command
will restart my system at 4
:15 pm $ sudo shutdown -r 16:15
If you want to cancel this scheduled restart, run the following command in your Terminal
: $
shutdown –
c The init command
The
init command
can be used as follows to reboot the system: $ init
6
The number that is used with the init command, from 0 to 6, controls the behavior of the system. This behavior and the corresponding actions are called execution levels. This is what these numbers and the corresponding runlevels indicate:
0 – Shut down the machine1 – Enter rescue mode2,3,4,5 – Start runlevelX.target unit
So these were 3 ways to restart your Ubuntu system from the command line. The reason for presenting all these forms was that if one of them doesn’t work for any reason, you have others to choose from.