You can restart your Ubuntu Machine using the reboot command in the command line. When you are using Linux Machine like Ubuntu it is most likely you love to use a command line to perform such small tasks.
But this post not about just a reboot command, we have many things to share that will be beneficial for our readers.
Why do you even need to restart your OS if it works well without performing such operation?
There are many reasons to do so. Like When you update your operating system then it is a must to restart your machine so that it can function well.
When you install a software application into your machine you are required to restart it or even when you Uninstall Programs from Ubuntu you need to do so.
When you make any changes in the configuration of the system then you will have to restart or reboot your Ubuntu Machine.
So there are various reason to restart or reboot the operating system.
What will you lean in this Posts?
Restarting Ubuntu using GNOME interface.
You will learn how to restart Ubuntu machine using command line interface using different methods.
Also, you will learn about shutdown command and useful options that are used with it.
How Restart Ubuntu Operating System?
Before you learn how to restart Ubuntu using the command you need to know how to restart Ubuntu using GNOME.
If you are a new Ubuntu user then there is a chance that you don’t find restart option in menu options.
You can see there is power off / Log Out section in the menu bar. But in the section there is Log Out, Switch User, Suspend and Power off option but not reboot or restart button.
How can an Ubuntu user restart his machine even using GNOME?
Well, it is so simple..
To restart or reboot your Ubuntu Machine click in Power Off option. Once you do it, you will get an option to restart your Ubuntu Operating System.
So, you will find a restart button when you click on the Power Off option in menu bar.
Restart Ubuntu Using Reboot Command
If you don’t want to get into so much technical stuff then the reboot command is the most simplest Ubuntu restart or reboot command for you.
It is very simple to run reboot command to restart your machine.
if you face any problem then use the following command-
$ sudo reboot
When you use “sudo” followed by the command then you will be asked for a password. Here, you will have to provide root password in order to execute the command.
Using Shutdown Command
Most of the user know that shutdown command is only used for turning your machine off. But that is not true, The shutdown command can also be used to reboot Ubuntu.
The shutdown command works on all the Linux distributions. The command halts the Linux Machine.
Here is the syntax for shutdown command-
$ sudo shutdown -r
Here -r means reboot the system
You can also scheduled the restart using the following command.
$ sudo shutdown [option] time [message]
How to apply this command properly?
$ sudo shutdown -h +15 "Scheduled Maintenance"
You already know about sudo and shutdown but you will have to use -h and the time that may be a number of minutes preceded by a + (plus) sign.
- -h means Halt the system
- +15 is the time in minutes
- Scheduled Maintenance is the message it will be in double quotation mark.
Useful Options That Can be Used With Shutdown command
- -r for rebooting the system.
- -h halt the system
- -k for kidding: The command do not really perform the shutdown operation in actual but broadcast warning messages to users as if the system were going down.
- – c the option is used for cancelling the shutdown.
Restarting Ubuntu Server using systemctl command
There are various use of systemctl in Linux machine. The shutdown command is the symbolic link to systemctl in some Linux distributions.
The systemctl command can be used for shutting down your Ubuntu as well as rebooting and suspending the system.
systemctl for rebooting Ubuntu Server
$ sudo ststemctl reboot
Using the reboot command with systemctl you can reboot your Ubuntu Server.
systemctl for shutting down the Ubuntu Server
$ sudo systemctl poweroff
You can run poweroff command to shut down your machine.
systemctl for Suspending the System
$ sudo systemctl suspend
If you want to suspend the system and reuse it after a while then you can use suspend command with systemctl.
So you learned how to restart Ubuntu from the terminal using commands like reboot and shutdown but there is one more way to perform such action that is initi command to restart ubuntu server.
Restart Ubuntu Using in init command
In Linux there are many use of init command and It can also be used in Ubuntu to restart the server or machine.
The init is called the parent of all the processes. The command has 0 to 6 run levels. The different number between 0 to 6 is used for different operation.
So the Question is which number you need to use for restarting your system?
Well, It is 6.
$ sudo init 6
The init command is used with number 6 to reboot Ubuntu.
What if you want to shut down your system?
In such a case you will have to use ‘0’ instead of ‘6’ for shut down.
In this tutorial post, we explained how to restart Ubuntu. We explained how to use the reboot command, shutdown command, systemctl command, and init command to reboot a Linux machine especially a Ubuntu server or machine. You can use any of these methods as each method do the same operation. But rebooting the Linux system with the reboot command is the easiest way.
Also, we covered how to restart your Ubuntu machine using GNOME user interface.