When working as a system administrator in Linux, most of the time configuration requires a system restart. Additionally, major server updates, system libraries, and kernel updates also demand a reboot of the system.
Rebooting a Linux machine to exit system programs without damaging data is a safe process. However, if you restart the system without saving essential data, you may lose it or corrupt it. Therefore, perform the reboot function when there is no possibility of damaging the data and there is no possibility of losing anything.
how to reboot linux
In Linux distributions, we have several ways to restart/reboot the system which include several command-line tools and a graphical user interface.
Reboot Linux System Via Command-Line Tools
This section will discuss all the popular utilities that help reboot Linux systems; Let's discuss them:
- reboot command
- systemctl command
- shutdown order
- init command
Reboot Linux System Using Reboot Command
reboot Command line tool is a shortcut and popular tool to restart the system without any hassle. To perform restart as administrator execute reboot command with sudo privileges:
For immediate process we can also use -F Parameters to restart the system without any delay:
Or you can run the reboot command with the path:
Reboot Linux system using systemctl command
The systemctl command-line tool in Linux monitors and configures Linux system services as they function. A user can enable, start, stop and stop any service with the help of systemctl command. Not only this, 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 the firmware system using systemctl command
Our machine can be restarted in the BIOS interface using the systemctl command. But this command will not work on all systems except modern devices, servers and desktops.
sudo systemctl reboot –firmware-setup
Reboot Linux System Using Shutdown Command
The shutdown command-line utility is used to safely shut down a Linux operating system. Not only this, it also allows stopping the machine (restricting the OS from functioning) and restarting the machine.
Run any of the following 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, -R The argument triggers the reboot function and you can also specify the time by which the task should be executed.
Let's use the above syntax by specifying the time and running the following command in the terminal:
In the above order:
shut down: Linux commands are used to shut down or restart a Linux machine.
-R: Linux asks to reboot the system.
+3: Linux tells the machine to wait for 3 minutes and then reboot.
For immediate reboot process, you can simply run the following command:
Or, you can also specify the full path as shown below:
If you want to reboot the system at a specific time, the format will be hh:mm where you have to mention the hours and minutes; like:
The shutdown command also allows to cancel the scheduled reboot process by passing the -c parameter:
Reboot Linux system using “init/telinit” command
short form of In this Linux has command tool initialization; As the name suggests, this command helps to initiate all the background processes and control them when the system boots.
We can also use the init command tool to restart a Linux machine with runlevel 6; Which is set to reboot the system in a background process:
With the full path, the command would be:
In Linux systems the reboot process can also be done using Telini Command which is used to control the init operations or we can say the front-end of the init processes.
To reboot your machine, run the telinit command by sending it to runlevel 6:
Reboot Linux Server Remotely
To remotely reboot a Linux server, we need to login via ssh as root user and follow the mentioned syntax:
ssh Root,remote-server.com ,sbin,reboot
Or for an immediate reboot action, use the syntax:
ssh Root,remote server ,sbin,reboot -R Now\
Replace remote-server with the IP address of the server you want to restart, like this:
ssh Root,192.168.1.1 ,sbin,reboot
Excessive:
When the system performs logout or login operation, it stores the record /var/logwtmp file. To fetch logout records from this file, use the command:
Reboot Linux system via graphical user interface
The simplest way to reboot a Linux machine is to use the GUI. Open the Linux desktop (I'm doing this on Ubuntu 22.04) and navigate the cursor to the power button:
click there Power off/log out choose more restart Among the options that appear next:
A popup will appear to confirm the restart process, click on it restart button:
conclusion
A rebooting operation is required when a user configures the system server and performs server compilation operations. Also, some kernel libraries require a system reboot when updating. However, a forced reboot may corrupt system files or cause loss of essential unsaved data.
Throughout this guide, we have performed reboot operations using several command-line tools. Popular command-line utilities that help restart a Linux system are the reboot, systemctl, init, and shutdown commands. Another easy way to perform the reboot function is to use the graphical user interface.