Restart Ubuntu via Command Line

Ubuntu is a popular Linux distributions used by millions of people. As a Linux distributions Ubuntu provides different methods and commands to restart via the command line interface.The restart operation simply stops the instance and then starts it without any extra action. The restart operation can be used to apply updates, reset temporary configurations or make configurations effective etc.

Restart Using shutdown Command

The shutdown command is created and used in order to shutdown the Linux systems. But the shutdown command provides different features where one of them is the ability to restart the system. We can use the shutdown command in order to restart Ubuntu. The -r option is provided in order to restart Ubuntu.

$ shutdown -r

If you get a permission error you should provide the root permissions in order to execute the shutdown command. The sudo command can be used to provide root permission to restart with the shutdown command.

$ sudo shutdown -r

Restart After Specified Time (Delay)

In some cases we may need to restart the ubuntu with some delay. We can specify some time as seconds in order to restart. The seconds we want to delay is provided as the last parameter to the shutdown command. In the following examle we restart Ubuntu after 40 seconds. The delay can be useful to shutdown database or complete work for other users.

$ sudo shutdown -r 40

Restart Using reboot Command

Another command to reboot Ubuntu is the reboot command. We can directly execute it without any parameter to restart Ubuntu.

$ sudo reboot

Restart Using systemctl Command

Ubuntu provides the systemctl command in order manage services. The systemctl command provides lots of features where it can be also used to restart Ubuntu system. The reboot parameter should be provided to the systemctl command to reboot system.

$ sudo systemctl reboot

Restart Using init Command

Linux systems provides the init command in order to change the system run level. Run levels describes different statuses of the system. The runlevel 5 is used to describe the reboot. We can use the init command in order to restart Ubuntu. The init command is located in the /sbin/ by default. We provide the run level 5 to the init command to reboot Ubuntu.

$ sudo /sbin/init 5

Leave a Comment