When personal computing first became a reality, we were more likely to power-off our machines for different reasons. Now, for the average user, power-related tasks may seem like an afterthought.
That is, until you need to reboot a remote server. I am going to show you a few commands you can use to reboot Linux from the terminal.
- If you want to reboot your Linux server, use this command:
- You may also use:
shutdown -r now
Commands for rebooting Linux
There are three main terms (and commands) when it comes to poweroff or reboot a system:
It’s important to remember that running commands like halt, particularly with options can lead erratic results like memory loss or data corruption. In other words, do not practice these commands while editing your Master’s thesis.
Note: User privileges may require you to be sudo user to run these commands.
Reboot performs the actions of the halt command (explained below), requiring that all processing stop. Then instead of triggering the ACPI signal, your system is restarted.
This command issues a hardware command that stops all CPU processing. The term itself comes from a much older era of computing. Back then, a signal would be sent to stop all processes and once it was safe to do so, the user would get a notification that they could turn off the machine.
In a more modern context, halt will stop all processes, but doesn’t send a ACPI (Advanced Configuration and Power Interface) signal.
The ACPI signal is the distinction between Halt and Poweroff. At least conventionally speaking. You may find that running the halt command actually turns off the power, at least without any options. To ensure this result, we want to use the designated poweroff command. This performs the actions of halt, but also sends a signal to your hardware to poweroff.
Note: You can also use shutdown command with option -r to restart.
Options while rebooting Linux
Here are some common options to the above mentioned commands:
As you might imagine, force bypasses the processes that typically faciliate a safe shutdown. This means that items running in volatile memory (RAM) are subject to corrpution or data loss. You may even lose data that was recently saved. This is not recommended.
-f --force Force immediate halt/power-off/reboot
Does not actually perform action, but writes a logout entry to var/log/wtmp.
Performs designated action, but does not create record.
Do not send a wall message before issuing command. It means that logged in Linux users won’t see any message about system being rebooted.
--no-wall Don't send wall message before halt/power-off/reboot
If you have to reboot because your system hung up, you may like to read this about handling a frozen Linux system.
I hope all of these tips taught you something new. If you like this guide, please share it on social media. If you have any comments or questions, please let us know.