As a Linux system administrator, you should be familiar with Linux command . In Linux desktop you can easily shutdown or reboot your system with GUI as well as command Line interface . But When you are working on Linux server remotely, and you want to shutdown or restart your server . This can be done easily with Linux command Line interface .
In this article we are going to discuss about , how to reboot Linux using command line .
How To Shutdown Linux Using The Command Line
The command required to shut down your machine is as follows:
It is highly likely that you need raised benefits to utilize the shutdown command so you will probably utilize the sudo order as takes after
If you want the computer to shutdown immediately use the following command:
sudo shutdown now
The time element can be specified in a number of ways. For example, you could use the following command to also shut down the computer immediately:
sudo shutdown 0
The number refers to the number of minutes to wait before the system attempts to shut down.
ncidentally, the command sudo shutdown without any time element is the equivalent of running the following command:
sudo shutdown 1
The default, therefore, is 1 minute.
You can also specify a set time in hours and minutes to shut down your computer as follows:
sudo shutdown 23:10
When the amount of time until shut down is less than 5 minutes the system will not allow any more users to login.
You can also use –poweroff option to shutdown your system.
sudo shutdown –poweroff now
How To Reboot Linux Using The Command Line
The command for reboot your computer is also shut down. There is also a reboot command to reboot your system .
use the following command to reboot their computer:
sudo shutdown -r
The same rules apply to the reboot command as they do for the shutdown command.
What this means is that by default the shutdown -r command on its own will reboot the computer after 1 minute.
To reboot immediately you have to specify either of the following commands:
sudo shutdown -r 0
sudo shutdown -r now
If you want the computer to reboot in 5 minutes you can specify the following command:
sudo shutdown -r 5
You can also specify a time to reboot the computer in hours and minutes as follows:
sudo shutdown -r 23:10
The following command will forcefully reboot the machine.
Make The System Halt
You can specify one more command which shuts down the operating system but doesn’t actually power off the machine.
The command is as follows:
sudo shutdown -H
You can also use the following command:
sudo shutdown –halt
How To Cancel A Shutdown
If you have scheduled a shutdown for the future then you can actually cancel the shutdown using the following command:
If you have used either shut down now or shutdown 0 then you can’t use this command because of not enough time .
It is probably a good idea to only shut down the system when you are at the console. Although you can shut it down remotely via a shell session, if anything goes wrong and the system does not restart properly, the system will be unavailable until action is taken at the system unit.
If you want to check out the manual pages for these commands: