The reboot command is used to reboot or restart the system in Linux. Whenever you make significant updates to the Linux system or any network configuration changes, you may need to restart your system to make these changes effective. These can be software or hardware updates that are being carried by the server.
For example, to update the new server kernel version, you need to complete the compilation, and for this purpose, a system reboot is necessary. When updating the server’s memory, NIC configuration and IP allocation are the main tasks that are complete when a reboot is done.
To perform the administrative activities, monitoring, and server management, several administrators of Linux system use servers through shell or SSH. So, the basic reboot commands of the server through shell are essential to know.
Linux Reboot Command
Here [options] are following:
- -help: help command will open the instructions text for this command
- -halt: halt command will stop the machine.
- -w, -wtmp-only: This command option writes only wtmp shutdown entry, but in reality, it didn’t halt, reboot, power-off the system.
Restart The System
To restart your system without going into details, use any of the below commands.
$ sudo reboot
Or you can use the shutdown command.
$ sudo shutdown -r now
These commands are almost the same in syntax and effect. To see more details of these commands, use -help while in that command.
Schedule A Restart
Reboot command has limited usage, but the shutdown command is an advanced version of the reboot. In scheduling, the shutdown command is commonly used to fulfill the requirements. Below is the syntax of the shutdown command to reboot the system at a specific time.
$ sudo shutdown -r [TIME] [Message]
Here [Time] can be in the following formats:
now: It is used if you want to restart the system right away.
+m: It indicates the time in minutes. +10 means restart the system in the next 10 minutes.
HH:MM: It indicates the time in a 24-hour clock.
[Message] is an optional parameter used to display users a notice text before the system reboot to avoid data loss.
$ sudo shutdown –r +10
The above command will reboot your system after 10 minutes.
$ sudo shutdown –r 04:00
The above command will reboot your system at 04:00 AM.
If you want to change the previous scheduled system restart or shutdown, you can call another shutdown command along with the -c option. Also, broadcast the cancellation restart message to users.
$ sudo shutdown -c
Restart remotely server
Login server to server using the SSH client and run below command
$ ssh firstname.lastname@example.org /sbin/reboot
Or you can use the shutdown command
$ ssh email@example.com /sbin/shutdown -r now
Restart with the Init command
The init command is a widely used command to start the processes in Linux and joint with the runlevel 6; (a number that is set to reboot the Linux server). The command syntax is below.
$ init 6
$ /sbin/init 6
Checking your reboot logs
‘/var/log/wtmp’ is a file record containing all logins and logouts records. You can see this file with the reboot command along with the last option. Below is the syntax of the last command, usage, and output.
$ last reboot
Before using the reboot command in your Linux system, it’s important to save all the unsaved documents in your session type. Then type
reboot in your terminal. The machine will immediately close all applications and restart.