Rebooting refers to reloading the operating system of a computer. It is not a simple process and is crucial for routine maintenance of the OS, troubleshooting, and for downloading and applying updates. So, how do you reboot Linux?
Consistent reboots contribute to the overall health of the operating system by preventing the emergence of problems that arise from continuous uptime.
Not only this, a reboot on Linux makes room for the implementation of configuration changes, frees up storage space occupied by unnecessary applications, and increases the overall speed of the operating system.
Moreover, rebooting is designed to be a friendly process. It gives users and the desktop the time to save files, exit programs, remove temporary files, and to update the filesystem journal.
Just like all other operating systems, rebooting is a requisite for Linux, but it’s cardinal to know that Linux is fully capable of running without a reboot for years.
This metric changes a bit when it comes to desktops and laptops as they need to be rebooted every few weeks.
Linux reboot is usually required after a major update so that the server can pick up the changes made by the user.
How to reboot Linux server
Although Linux doesn’t need to be rebooted that frequently, it still offers plenty of choices for when it’s time to start over.
Let’s discuss the different ways to reboot Linux, starting with GUI.
Rebooting via Graphical User Interface (GUI):
To reboot Linux via GUI is the easiest and the most beginner-friendly method. However, the only setback of this method is that it can only be used in desktop installations.
Here, we have covered how you can reboot Linux systems running Gnome, Mate, and KDE-based distribution systems.
- Reboot Gnome-based Linux systems: The first step in this process is to restart the desktop. This can be done by clicking on the top right-hand corner of the desktop which will open up a drop-down menu. Select the power-off/logout option.
Then, select the restart option from the sub-menu.
You will now see a dialogue box on your screen that will be asking for your confirmation regarding whether to restart the desktop or not.
To reboot you should click on the restart button. If you don’t click on any button for 60 seconds, your desktop will automatically get rebooted.
- Reboot KDE-Based Linux systems: Rebooting these desktops is as easy as Gnome based desktops. Firstly, open the application tray from the lower-left corner of the screen or press the Super key on the keyboard. The Super key usually has a windows icon on top of it.
Now select the ‘Quit’ button from the bottom of the application tray.
You will now come across a new dialogue that will give you three options; Suspend, Restart, or Shutdown. Choose restart to reboot Linux.
- Reboot MATE-Based Linux systems: Click on the system button on the top-left corner of your desktop screen. Now select the ‘shutdown’ option from the drop-down menu.
Another way of doing this is by clicking on the menu button on the bottom left corner of the screen. From there, click on the power icon ( ⏻ ) situated at the bottom of the application menu.
Just like KDE-Based Linux systems, you will now see a dialogue box on your screen that will give you the options to either suspend, restart, or shutdown your desktop. Choose restart to initiate reboot on the Linux system.
Rebooting from the Command line
Following are four basic prerequisites of rebooting Linux via Command line.
- A Linux operating system
- Access to the Terminal
- Root or sudo privileges
- SSH software package (in some cases).
First step in this process is to open the terminal. It is also the most popular way of managing your Linux operating system.
The two most easiest ways of doing this are:
- The keyboard shortcut – Press Ctrl + Alt + T simultaneously on your keyboard to open the Terminal application.
- Applications menu – Open the applications menu from the bottom left corner of your screen. Search for “Terminal” in the search bar and then click on >_ icon to open Terminal.
To open the terminal on a remote server, use the ssh command to connect to it.
The syntax is: ssh [username]@[your_server_ip]
Replace username with your desktop username and your server ip with your server’s IP address.
Now it’s time to move on to the second step which is using the Linux reboot command. Once you successfully access the terminal, choose the restart option to reboot Linux.
A majority will need sudo privileges to restart a Linux server by using this command.
The command will ask for user password to enable the administrative privileges before beginning the system restart.
Last but not least, wait for the reboot to complete.
As soon as you issue the command, the system starts rebooting. Your desktop screen will get blank and you will see different messages on screen. Soon after it the operating system logo appears on the screen and the desktop boots back up.
The time taken by a Linux server to reboot depends on multiple factors including the hardware and assigned resources.
- Reboot Linux via Shutdown Command: The shutdown command is another routine method for rebooting Linux. It instructs the system to restart by specifying the -r option.
Run the shutdown command with the argument -r now to restart the server.
[ sudo shutdown -r now ]
If you want to schedule the reboot for later then replace ‘now’ with a specific time in the manner ‘hh:mm’ or use the following command:
[ sudo shutdown -r +5 ]
In this case shutdown is the name of the reboot Linux command, -r is the option that tells the system to restart your desktop, and +5 denotes the time for which the system will wait before restarting.
To broadcast a custom message with your standard shutdown command, type your message after the time argument. For example: [ sudo shutdown -r
+15 “Hardware upgrade” ] will shutdown the system in 15 minutes and issue a notification that a hardware upgrade will be performed.
Lastly, this command relies on sudo so you are supposed to type in your password when your PC asks for it.
To force an immediate reboot in your Linux operating system, use command [ sudo reboot -f ]. In this command, -f stands for forceful & immediate rebooting of the system.
If you want to power off your desktop immediately you should run the shutdown command with the argument -P now.
[ sudo shutdown -P now ]
You can use the -c option to cancel a reboot or shutdown that is already in process when time is set. Use command [ shutdown -c ].
Undoubtedly, the shutdown command is a safe way to reboot your computer. It prevents new logins within the last five minutes of shutdown commencing, thus lowering the chances of losing any data.
Advanced techniques to reboot Linux server
- Using the init command
Compared to the other methods of rebooting Linux, this method is quite old and is mostly replaced by systemctl and reboot commands.
However, SysVinit system users may still want to restart the server using the init command:
[ sudo init 6 ]
On Linux servers, there are upto 7 runlevels that your computer can understand. 0 indicates a halt state and 6 is for reboot.
Provide your password when prompted and let the server complete the restart process. This command leaves no output, but it does restart the system.
- Using systemctl command
Unlike the init command, the systemctl command is more of a recent innovation. Systemd, system, and service manager in many modern Linux distributions is designed to provide much more control and flexibility.
This command allows administrators to manage services, view their status, start or stop them, and restart them individually.
However, it is crucial to know that to restart a Linux server using the systemctl command, you need sudo or root privileges.
To reboot Linux, use the following command:
[ sudo systemctl reboot ]
Moreover, this command asks for your password before restarting so provide the password when prompted and then hit ‘enter.’
Like the init command, the systemctl command also does not have an output, but it does begin the restart process for the entire system.
The whole reboot process may take up to a few minutes.
Reboot Linux responsibly
It is good to have ample knowledge about different ways of rebooting your Linux operating system, but this does not mean that you should use all the options.
Before initiating a reboot, it’s important to think it through in terms of what you are trying to accomplish and what the method you have chosen will end up doing.
Reckless rebooting has the power to do irreparable damage to your desktop so please be careful before selecting and initiating the rebooting process.
Thinking so much doesn’t mean that you lose trust in the power and importance of rebooting because no matter what, it plays a significant role in maintaining the overall health of the operating system.
- You may also be interested to read: What Is Open Source Software?