Linux Reboot (Restart) Command
3 min read
When the kernel is updated, unless you’re using Ksplice or KernelCare you need to reboot your Linux system. A system reboot may also be required in other circumstances, eg, when troubleshooting hardware issues, installing applications, and so on. If you’re running a headless Linux server, you need to know how to restart the system from the command line.
On most modern Linux distributions, the
systemctl utility replaces the most of power management commands used in the older Linux distributions with sysvinit. The
shutdown commands are aliases to
systemctl and are available in the system for compatibility reasons.
In this tutorial, we’ll explain how to use the
shutdown commands to reboot your Linux machine. The commands must be run as root or user with
To reboot your Linux system simply type
sudo systemctl reboot
The system will be restarted immediately.
When the reboot is initiated, all logged-in users and processes are notified that the system is going down, and no further logins are allowed. Linux will close all open files, stop the running processes, and restart the system.
To prevent the reboot command from sending a message, run the command with the
sudo systemctl --no-wall reboot
If you want to set a custom message explaining the reason for the reboot, use the
sudo systemctl --message="Hardware upgrade" reboot
The message will be shown in the logs:
System is rebooting (Hardware upgrade)
When used with the
-r option, the
shutdown command performs a system reboot:
sudo shutdown -r
By default, the system will be rebooted after 1 minute, but you can specify the exact time when you want the system to be rebooted.
The time argument can have two different formats. It can be an absolute time in the format
hh:mm and relative time in the format
+m where m is the number of minutes from now.
The following example will schedule system reboot at 10 A.M:
sudo shutdown -r 10:00
The following example will schedule system reboot in 5 minutes from now:
sudo shutdown -r +5
To shut down your system immediately use
+0 or its alias
sudo shutdown -r now
To broadcast a custom message along with the standard shutdown notification, type your message after the time argument.
The following command, will shut down the system in 10 minutes from now and notify the users that a hardware upgrade will be performed:
sudo shutdown -r +10 "Hardware upgrade"
It is important to mention that when specifying a custom wall message, you must specify a time argument too.
If you have scheduled reboot and you want to cancel it, run
shutdown command with the
sudo shutdown -c
You can also broadcast a message describing why the reboot was canceled:
sudo shutdown -c "Canceling the reboot"
To reboot a Linux system type
reboot in your terminal. It will take several seconds for the operating system to restart.
Feel free to leave a comment if you have any questions.