blog posts

How To Restart An Ubuntu Server?

Restart Ubuntu

The command prompt is used by most Linux users, especially SysAdmins, to perform common operations in Ubuntu. One of them is restarting your device. Restarting the computer can have various reasons. One of these is that certain software requires a system reboot to fully set up and run after installation. Some updates in Ubuntu require a system restart to update the programs. Another compelling reason to reboot is to fix a software problem. Now you understand why sometimes a system restart is necessary. Next, we will check together how to restart Ubuntu version 20.04.

In this educational post, we teach how to restart the Ubuntu server version 20.04 in 3 ways in the terminal environment.

You can open the terminal by pressing Ctrl+Alt+T. Or you can run the terminal by right-clicking on the screen and clicking Open in the terminal.

Prerequisite:

First, you must access your virtual server through SSH, and you can use a client software called PuTTY. Click on this link to see the full tutorial on working with PuTTY to establish an SSH connection.

The first method: using the Reboot command

 

The first method to restart the Ubuntu server is through the reboot command. The reboot command is the easiest way to revive your device without turning it off. This expression is usually used without any extra symbols or parameters. But, we can use some flags in our examples. So, in our first example, we’ll use the reboot keyword and press Enter to run it:

reboot

Sometimes, the user may encounter some errors while restarting the system. To avoid any possible errors, we will use the command “reboot” wiSudosudo” privileges as you can see below:

sudo reboot

 

Another complementary and widely used command for reboot is the sbin command. This command makes the system perform the necessary updates automatically after restarting.

sudo /sbin/reboot

 

If you want your Ubuntu system to restart quickly and without color, use the following command.

sudo reboot now

 

If you want to force reboot your system by ignoring all the processes currently running on your device, you should use the -f parameter in the reboot command below.

sudo reboot -f

The second method: using the Shutdown command

 

The shutdown command is used to shut down the device. But the -r parameter can also be used to restart Ubuntu when running. Therefore, we use it in the terminal to restart the system or shut down it.

sudo shutdown -r

 

You can also use the same command with the new keyword to reboot or shutdown your Ubuntu 20.04 system. This method is faster than the above command.

sudo shutdown -r now

 

You can also use the shutdown command to schedule a system restart at a specific time. We can use a time frame instead of now. 0 indicates immediate shutdown or restart. The parameter H-, which refers to the stop, can also be used. This parameter causes the system to first kill all activities before shutting down the processor.

sudo shutdown -r H +0

 

If you want to restart Ubuntu after, for example, 10 minutes, do the following:

sudo shutdown -r +10

Suppose you want to restart or shut down your Ubuntu system at a specific time, that is, at 20 hours and 25 minutes. You need to specify the exact time in the format “hour:minute: second”. You can see this command format below.

sudo shutdown -r 20:25

 

If you want to cancel all previously programmed settings for restart or shutdown, you must use the “-c” parameter after the shutdown command.

sudo shutdown -c

The third method: using the Init command

 

We can also use the “init” command to restart our Ubuntu system. Your system’s performance is controlled by the value you enter with the init directive, which ranges from 0 to 6. Parameter 0 in the init command means to turn off the device quickly.

$init 0

 

Parameter 1 will be used to reach the rescue mode of your system. It keeps your apps and system data safe during restarts or shutdowns and allows you to perform security updates.

$init 1

Other digits from 2 to 6 can allow you to reboot or shut down your system by running the “runlevelXtarget” unit.

If you are working on a remote Ubuntu server, you can restart or shut it down like this. (using SSH)

$ ssh root@remote-server-com /sbin/reboot

$ ssh root@remote-server-com /sbin/shutdown

Conclusion

This article tells you the most common and easiest ways to restart and shut down the Ubuntu 20.04 operating system. As you can see, we had a lot of options for restarting in Ubuntu. We can choose one according to our needs.