Rebooting a Linux system might seem straightforward, but there are several ways to do it depending on your needs and the system’s condition. Whether you’re a new Linux user or an experienced sysadmin, knowing multiple Linux reboot commands can be useful, especially in troubleshooting or maintenance situations.
From standard commands to emergency alternatives, Linux offers flexible options that can ensure a smooth restart or provide a quick fix when your system becomes unresponsive.
In this post, we’ll walk you through eight easy methods to reboot a Linux system. We’ll cover everything from the most common commands, like reboot
and shutdown
, to more advanced techniques like using systemctl
and init
. Each method has its advantages and specific use cases, so by the end, you’ll know exactly which command to use in various scenarios to keep your system running smoothly.
Table of Contents
Method 1 – The standard Linux Reboot Command
The reboot command is used in Linux systems to initiate a system reboot. It is a common way to restart the operating system. It’s worth noting that the reboot command requires root or superuser privileges, so you may need to add the sudo prefix it and enter your password to execute it successfully.
The basic syntax of the reboot
command is as follows:
sudo reboot
This will give a message like the image shown below:
Options
This command has various options that you can use to specify the behavior of the reboot. Here are some commonly used options:
--help
: This option displays the help information for thereboot
command by showing available options and their usage. Here is the information it gives:
As you see in the image, other options are:
--
halt
: This option is used to halt the system before restarting. When you usereboot --halt
, the working of the system will stop.-f
or--force
: This option forces an immediate reboot, performing a hard shutdown.-p
or--poweroff
: This option shuts down the system and switch it off completely instead of rebooting.-w
or--wtmp-only
: This option does not actually perform the reboot. It writes records to the/var/log/wtmp
file.
Method 2 – sudo shutdown -r now
The shutdown
command is used to shut down a Linux system. It provides a controlled shutdown process as it allows setting the shutdown time, display warning messages or cancel the shutdown. The point is the shutdown -r now
command and the reboot
command both serve the purpose of restarting a Linux system.
sudo shutdown -r now
The -r
option specifies that the system will be rebooted, while the now
option specifies the operation will be performed immediately. This is why two of these commands are alternatives to each other. Here is an example:
The shutdown command also accepts different options and parameters, for example, the command scheduling a shutdown at 10:40 PM (22:40):
sudo shutdown -r 22:40
Note that, these was a few examples to give insights to the shutdown command. It has various options to change the behaviour of the shutdown process.
Method 3 – Linux reboot command using using systemctl
sudo systemctl reboot
Method 4 – reboot Linux using init
Here, init 6
tells the system to go to runlevel 6, which is designated for rebooting the system.
sudo init 6
Method 5 – Linux reboot using telinit
This is another way to switch to the reboot runlevel.
sudo telinit 6
Method 6 – Using sysrq-trigger
This bypasses some layers and is a “hard reboot” that immediately restarts the system without unmounting filesystems cleanly. It’s best for emergencies when other commands aren’t working.
echo b | sudo tee /proc/sysrq-trigger
Method 7 – Using pkill to Restart the Systemd Process
This will cause systemd to restart, which in most cases will trigger a system reboot.
sudo pkill -HUP systemd
Method 8 – Forceful Linux reboot command
The -f
option forces an immediate reboot, skipping some shutdown scripts. This is also not a “clean” reboot but can help in situations where a normal reboot command isn’t responsive.
Each method has its own purpose and use case, so it’s good to select the one that matches the system’s current condition and whether a clean reboot is possible.
sudo reboot -f
Best Practises
When rebooting a Linux system, there are several considerations to keep in mind to ensure a successful restart. Here are some important points to consider:
- Save your work: Save any unsaved work and close any open applications or documents to avoid data loss or corruption.
- Update System: If there are pending system updates, it’s generally recommended to install them before rebooting.
- Backup important data: If you have important data on the system, it’s always a good idea to have a backup before rebooting.
- Check System After Rebooting: Rebooting may stop some services, make sure all system processes are still running after restart.
By following these practises, you can minimize the risk of data loss and have a successful reboot of your Linux system.
Conclusion
To sum up, the Linux reboot command is used to restart the entire system. Once the command is executed, the Linux system shut down and start up again thus resulting in a complete reboot of the system.
Thank you for reading.