While working as a system administrator in Linux, most of the time configurations need a system restart. Moreover, major server updates, system libraries, and kernel updates also demand rebooting of the system.
Rebooting a Linux machine is a safe process to exit system programs without harming data. However, if you restart the system without saving the necessary data, you may lose it or end up corrupting it. So, perform the reboot function when there’s no chance of damaging data and nothing to lose.
- How to Reboot Linux
- Reboot Linux System Through Command-line Tools
- Reboot Linux Server Remotely
- Reboot Linux System Through Graphical User Interface
- Conclusion
How to Reboot Linux
In Linux distributions, we have various ways to restart/reboot the system including multiple command-line tools and a graphical user interface.
Reboot Linux System Through Command-line Tools
This section will discuss all the popular utilities that help to reboot the Linux system; let’s discuss them:
- reboot Command
- systemctl Command
- shutdown Command
- init Command
Reboot the Linux System Using the reboot Command
The reboot command line tool is a shortcut and popular tool to restart the system without any hurdle. Execute the reboot command with the sudo privileges to perform the restart function as an administrator:
For the immediate process, we can also use the -f parameter to forcefully restart the system without any delay:
Or you can run the reboot command with the path:
Reboot the Linux System Using the systemctl Command
The systemctl command-line tool in Linux monitors and configures Linux system services when they function. A user can enable, start, stop, and turn off any service with the help of the systemctl command. Not only this, but this command works as a multitasking tool, which is also used to restart the Linux machine.
Type the mentioned systemctl command in the terminal to perform the restart task:
Reboot Firmware System using systemctl Command
Our machine can be restarted into BIOS interface using the systemctl command. But this command will not work on all systems, except modern devices, servers, and desktops.
Reboot the Linux System Using the shutdown Command
The shutdown command-line utility is used to shutdown the Linux operating system safely. Not only this, it also allows to halt (restrict the OS to stop performing functions) and restart the machine.
Run any of the given shutdown commands in the terminal to reboot the Linux machine:
The syntax to restart the machine through the shutdown command tool is as follows:
In the above syntax, the -r argument triggers the reboot function and you can also specify the time by which the task should be performed.
Let’s utilize the above syntax by assigning the time and running the following command in the terminal:
In the above command:
shutdown: Linux command used to shut down or restart the Linux machine.
-r: Asks the Linux system to reboot.
+3: Tells the Linux machine to wait for 3 minutes and then reboot.
For the immediate reboot process, you can simply run the following command:
Or, you can also assign the full path as mentioned below:
If you want to reboot the system at a specific time, the format would be hh:mm where you have to mention hours and minutes; like:
The shutdown command also allows the cancellation of the scheduled reboot process by passing the -c parameter:
Reboot the Linux System Using “init / telinit” Command
The abbreviation of init command tool in Linux is initialization; as the name describes, this command helps to initialize all of the background processes and control them whenever the system boots up.
We can also utilize the init command tool to restart the Linux machine with the runlevel 6; which is set to reboot the system in the background process:
With the complete path, the command would be:
The reboot process in a Linux system can also be done using the telinit command which is used to control the init operations or we can say the front-end of init processes.
Run the telinit command by sending it to the runlevel 6 to reboot your machine:
Reboot Linux Server Remotely
To remotely reboot the Linux server, we need to login via SSH as the root user and follow the mentioned syntax:
Or for the immediate reboot action, use the syntax:
Replace the remote-server with the IP address of the server you want to restart, like:
Additional:
When the system performs logout or login operations, it stores the record in the /var/logwtmp file. To fetch the logout record from this file, use the command:
Reboot Linux System Through Graphical User Interface
The simplest way to reboot the Linux machine is using the GUI. Open the Linux desktop (I am performing this on Ubuntu 22.04) and navigate the cursor to the power button:
There, click on Power off/Log out and select Restart from the further appeared options:
A popup will appear to confirm the restart process, click the Restart button:
Conclusion
Rebooting operation is required when a user configures the system server and or performs server compilation actions. Also, some of the kernel libraries demand system reboots while updating. However, the forceful reboots may also lead to corrupt system files or loss of necessary unsaved data.
Throughout this guide, we have performed reboot operations by using several command-line tools. The popular command-line utilities that help to restart the Linux system are the reboot, systemctl, init, and shutdown commands. Another easy way to perform the reboot function is using the graphical user interface.