Linux system reboot required in many circumstances, like troubleshooting hardware issues, installing applications, kernel update, etc. This guide explains how to reboot (restart) the Linux system using command line.
In the latest Linux distros includes the
systemctl utility. The reboot and shutdown commands are aliases to
systemctl and are available in the system for compatibility reasons. You can use
shutdown commands to reboot your Linux machine. Ensure that you must login a root user or having sudo privileges.
You can simply run
systemctl reboot to reboot your Linux system.
sudo systemctl reboot
Once 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.
If you don’t want to send message, just run command with
sudo systemctl --no-wall reboot
Sometime if system reboot is required due to hardware maintenance and you want to set custom message then you can use
sudo systemctl --message="Hardware change" reboot
It will be shown in log as below:
System is rebooting (Hardware change)
You can use shutdown command along with
-r option to reboot the system.
sudo shutdown -r
Linux system will be reboot after 1 minute. You also can set specific time for reboot the system. You can pass the time argument using two different formats. It can be an absolute time in the format
hh:mm or relative time in the format
m is the number of minutes from now.
For example, if you want to reboot system at 11:A.M. then run below command:
sudo shutdown -r 10:00
If you want to reboot system after 15 minutes, type:
sudo shutdown -r +15
To display a custom message along with the standard shutdown notification, type your message after the time argument.
sudo shutdown -r +10 "Hardware upgrade"
The above command will shutdown the system after 10 minutes from now and it will notify the users that a hardware upgrade will be performed.
You also can
cancel the scheduled reboot using below command:
sudo shutdown -c
To specify the custom message why the sheduled reboot has been canceled by typing:
sudo shutdown -c "Reboot cancel"
You can reboot your Linux system by just typing reboot in your terminal. In few seconds it will restart.