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.