Linux Commands lines are very useful, important and much more effective. It comes into play, whenever you want to reboot, restart and shutdown the system.
But it is much more essential and at its best when you are using a single boardÂ computerÂ â€“Â Raspberry PIÂ and when you want to reboot a remote linux server.
On this article, youâ€™ll learn how to easily reboot, restart and shutdown your Linux system using the commands line. Understand that you need to restart servers whenever upgrades are installed.
And to shutdown theÂ Linux systemÂ is also important, this is in order to bring in its maintenance tasks. It is also effective when you are running a headless computer (one without a display).
Fortunately, you can shutdown the computer down and restart it without physically pulling the power. The following commands are available on any linux system like centos, ubuntu, debian, fedora or suse.
And guess what, none of the following commands need or require the installation of any extra packages. Lets get started with the commands line.
How To Reboot Linux Based System
Here, youâ€™ll learn how to reboot a remote Linux system or server using command line. This is just to reboot your Linux system and it can be done using its commands line.
These are Linux reboot command. But understand that the command for rebooting your computer is also shutdown.
sudo shutdown -r
This is the normal commands used in shutdown and reboot.
sudo shutdown -r 0
The shutdown -r command on its own will reboot the computer after 1 minute.
sudo shutdown -r 5
This is if you want the computer to reboot in 5 minutes.
sudo shutdown -r 22:00
This is if you the computer to reboot in hours and minutes.
sudo shutdown -r 22:00 â€œthe system is going to bounce. Boing!!!â€
This is a specific message to let all the users know that the system is going to reboot in hours.
sudo shutdown â€“reboot now
This is totally different, which you can use instead of the -r switch.
How To Shut Down Your Computer Using the Linux
These are the Linux shutdown command, it is used to shut down your machine or computer. As we all know, the default action for the shutdown is to power off.
â€œshutdown arranges for the system to be brought down in a safe way. All logged-in users are notified that the system is going down and, within the last five minutes of TIME, new logins are prevented.â€ â€“ Scott James Remnant
However, the quick way to shut down your system from a terminal session, is to sign in or â€œsuâ€ to the â€œrootâ€ account. Then type â€œ/sbin/shutdown -r nowâ€.
It may take several moments for all processes to be terminated, and then Linux will shut down. The computer will reboot itself. But it can be rebooted with â€”.
This is the Linux command used to shut down your computer.
Most of the Linux commands are Sudo commands. From the output will say â€œshutdown scheduled for, just use shutdown -c to cancelâ€.
sudo shutdown now
This is to specify when you want the computer to shut down. This will shut down the computer immediately.
sudo shutdown 0
This will automatically shut the system without hesitation.
sudo shutdown 1
This is to shut the computer within 1 minutes. That means, the machine will have to wait before the system attempts to shut down.
sudo shutdown 22:00
This is to shut the system in hours.
sudo shutdown 5 â€œsave your work, system going downâ€
This is to notify all your users about the time when the computer will shutdown. And you can easily outline a specific message informing them.
And when the amount of time until shut down is less than 5 minutes, the system will not allow any more users to log in.
sudo shutdown -P now
This is another switch you can use. The -P actually stands for power off. Using the -P switch, guarantees that the machine powers off and doesnâ€™t just halt.
sudo shutdown â€“poweroff now
This is the same Linux commands to shutdown the computer, and you really donâ€™t switches.
How To Halt A Linux System
For other commands, you can easily halt Linux system. Understand that shutting down the operating system but doesnâ€™t actually power off the machine.
Anyways, this is to halt the system. Know that halt, poweroff, reboot may be used to halt, power-off or reboot the
sudo shutdown -H
sudo shutdown â€“halt
How to Cancel A Shutdown
If after youâ€™ve successfully scheduled a shutdown, you can actually cancel the shutdown.
But know that, this method on how to cancel a shutdown will NOT work when you have used either shut down now or shutdown 0.