In this article we will discuss the different ways to reboot a system from the command line. The commands we will be focusing on are “shutdown” and “reboot”
To issue these commands you will need to be logged in as root, or using sudo to elevate your privileges.
The Shutdown Command
You might be thinking, why am I using the shutdown command? This command is also capable of rebooting a system. It will also broadcast a message to all tty users about an impending shutdown or reboot.
The basic syntax is:
shutdown [option] TIME [MESSAGE]
To issue an immediate reboot, use the -r option and “now” as the time.
shutdown -r now
If you wanted to reboot the system at 16:30 (4:30 PM) and you wanted to notify users with a custom message you were rebooting to load a new kernel. The command you would issue is:
shutdown -r 13:35 "System rebooting to load new kernel"
Using the shutdown command will always issue the default broadcast message.
The Reboot Command
The reboot command basically does an instant reboot. It mimics the using shutdown with -r now. It sends a notification, but does not provide any mechanism for scheduling or extending the timing of the notification.
Rebooting the system from the command line is simple. If you are running a multi-user system, or have multiple admins that can possibly working on the same box, it is recommended that you send at least a short notification.
Just like everything else Linux, there are most likely more ways to accomplish a single task. If you know of any, we would love to hear from you in the comments.
This site uses Akismet to reduce spam. Learn how your comment data is processed.