How To Reboot or Restart Linux System From Command Line
This post will guide you how to restart or reboot your Linux Server From the command line in a remote Linux server. How do I remotely reboot Linux system using reboot or shutdown command line in Linux system.
- Reboot Command
- Shutdown Command
- Restarting Linux System Using Reboot Command
- Restarting Linux System Using Shutdown Command
- Restarting Linux System From a Remote System
Reboot Command
Reboot Command can be used to halt, poweroff, reboot may be used to halt, power-off or reboot the machine.
The syntax of the Reboot command is as follows:
reboot [OPTIONS...]
Options:
--help Print a short help text and exit. --halt Halt the machine, regardless of which one of the three commands is invoked. -p, --poweroff Power-off the machine, regardless of which one of the three commands is invoked. --reboot Reboot the machine, regardless of which one of the three commands is invoked. -f, --force Force immediate halt, power-off, or reboot. When specified once, this results in an immediate but clean shutdown by the system manager. When specified twice, this results in an immediate shutdown without contacting the system manager. See the description of --force in systemctl(1) for more details. -w, --wtmp-only Only write wtmp shutdown entry, do not actually halt, power-off, reboot.
Shutdown Command
shutdown command may be used to halt, power-off or reboot the machine.
The syntax of the Shutdown command is as follows:
shutdown [OPTIONS...] [TIME] [WALL...]
Option:
-r, --reboot Reboot the machine.
Restarting Linux System Using Reboot Command
If you need to restart or reboot your linux system from the command line, and you can use reboot command , type:
$ reboot
or
$ sudo reboot
then your Linux system should close out of all open applications and restart your system.
Restarting Linux System Using Shutdown Command
You can also use “shutdown” command to reboot your Linux system, and you just need to pass the “-r” option to the shtudown command, type:
$ sudo shutdown -r
If you want to reboot your Linux system in 15 minutes, and you can use the following command:
$ sudo shutdown -r +15
If you want to reboot your Linux system in a certain time, and you can type the following command at the shell prompt:
$ sudo shutdown -r 18:06
Restarting Linux System From a Remote System
If you want to reboot a remote Linux system from your current linux system, and you need to ssh to connect to remote Linux system, and then executing “reboot” command to restart your remote server. type:
$ ssh -t username@remoteServer.com "sudo reboot"
Note: the ssh command will connect to the remote server from your current Linux server. And the “-t” option will force the remote system to execute the command in a bash shell. You need to replace “username@remoteServer” with the username@server name that you want to restart.
Conclusion
You should know that how to reboot a remote Linux server from your current working Linux system using ssh/reboot commands in your Linux system.