Most people are familiar with rebooting their Linux system with a few clicks of the mouse, but not everyone is as familiar with rebooting a Linux system from the command line. It may seem daunting, but learning; how to reboot Linux with a command can be an invaluable skill.
Imagine suddenly, that the system goes down or the GUI does not respond. Now, you need to get it back up and running quickly. Knowing how to reboot the Linux system from the command line can save the day. In this guide, we will discuss how to reboot a Linux system with a command, so let’s begin.
Difference Between Rebooting and Restarting
Understanding the difference between rebooting and restarting is important when learning how to reboot a Linux system from the command line. Rebooting is the process of shutting down the system and then starting it up again. Restarting is the process of shutting down the system and then starting it up again without shutting it down.
Rebooting is more thorough because it ends all ongoing activities or tasks on the computer. Restarting is less thorough because it leaves any running processes and unfinished tasks in place.
How to Reboot Linux System with Command
Linux is an open-source operating system widely used for various purposes, including servers, desktops, and embedded systems. As with any operating system, it is essential to know how to reboot Linux when necessary.
To reboot a Linux system with a terminal command, you must first open the terminal. The terminal is a command-line interface that allows you to interact with the Linux system using text commands. You can open the terminal by pressing Ctrl + Alt + T.
Here is a list of ways you can use to reboot your Linux system with the Terminal:
1. Reboot Command
The straightforward method to reboot a Linux system is by using the reboot command. For that, open the terminal and run the following command:
sudo reboot
The command will reboot the system immediately. It is recommended to use this command only when necessary, as it does not provide any warning or prompt.
However, there are some options to use with the reboot command. Here is how:
sudo reboot <option>
Options | Description |
---|---|
-f |
When this flag is used, the normal process of shutdown is not followed. Instead, the power to the system is directly cut off, and a hardware signal is sent to the kernel to boot the system back up. |
-w |
When this flag is used, only an entry is made in the “system wtmp logs ” instead of actually rebooting. |
--help |
This flag is used to view the help menu of the reboot command consisting of the options and the syntax to use the reboot command |
2. Shutdown Command
You can also use the “Shutdown” command to reboot your Linux system. For that, run the below command:
sudo shutdown -r now
The command will shut down the system and immediately reboot it. The -r option specifies that the system should reboot after shutting down, and the now option specifies that the shutdown should happen immediately.
3. INIT command
You can also use the init command. It is the first process executed by the kernel during the booting of a system. To reboot your system using the init command run the following terminal command:
sudo init 6
It is a legacy command that is used to reboot the system. In Linux, the init 6 command gracefully reboots the system running all the Kernel shutdown scripts first, before rebooting. The reboot command does a very quick reboot. It doesn’t execute any kill scripts, but just unmounts filesystems and restarts the system.
Note
sudo init 6 is not commonly used on modern Linux distributions.
4. Reboot the Linux System with systemctl
You can also reboot your Linux system using the systemctl command. For that, run the following command on the Terminal:
sudo systemctl reboot
The command will reboot the system using the systemd service manager, the default system manager on many modern Linux distributions.
The above-mentioned four commands can reboot any Linux system.
Note
It is important that rebooting a Linux system will close all running applications and processes, so save any unsaved work before initiating a reboot.
How to Reboot Linux using the GUI
Rebooting a Linux system using the Graphical User Interface (GUI) in Linux distributions is the easiest method, accessible even to beginners.
However, this approach comes with a significant tradeoff: rebooting via the GUI is only possible in desktop installations. Here, we will discuss rebooting Linux systems running GNOME.
To do so, you can follow the following steps:
1. Click on the top right-hand corner of the desktop, where you will find the icons for network connectivity, volume, and power.
2. A drop-down menu will appear as shown below. Click on the Power Off/Log Out option from the menu.
3. Then, select the Restart option from the sub-menu.
4. This will open a new dialog box asking whether to restart the system or not. Click on the Restart button to reboot your system.
Note
If you do not select any option within 60 seconds, the system will automatically reboot.
Conclusion
That’s it; this is how you can reboot a Linux system with a terminal command. Learning how to reboot Linux with a command line can be a valuable skill. With practice, anyone can learn how to use the terminal to reboot the Linux system.
However, you can use any of the methods mentioned above. Here we discussed rebooting the Linux system using the – Reboot, Shutdown, INIT, and systemctl commands. We hope you find this guide helpful.