How can I shutdown my Linux box from the terminal? What is the linux shutdown command to turn off or reboot my computer? Here we will answer all this questions in a simple and easy way.
What is the Linux shutdown command ?
Linux includes the famous “shutdown” command, which is an utility to reboot, halt or turn off our running operating system. Let’s see how it looks like.
[webtech@localhost ~]$ shutdown --help shutdown [OPTIONS...] [TIME] [WALL...] Shut down the system. --help Show this help -H --halt Halt the machine -P --poweroff Power-off the machine -r --reboot Reboot the machine -h Equivalent to --poweroff, overridden by --halt -k Don't halt/power-off/reboot, just send warnings --no-wall Don't send wall message before halt/power-off/reboot -c Cancel a pending shutdown [webtech@localhost ~]$
As you see in the previous “help” command, the shutdown linux command
How to shutdown linux from command line?
What is the best way to use the shutdown command on Linux? Simple and easy, just follow this examples for both, local computers or enterprise grade servers:
Reboot your computer immediately:
shutdown now -r
Turn off your Linux operating system:
shutdown now -h
Suspend / Halt your server:
shutdown now -H
What’s the difference between “shutdown” command and “shutdown now”?
‘shutdown’ command without other parameters will just execute the order, but other already submitted tasks will continue running.
‘shutdown now’ will do the same, however it will kill all the running tasks by terminating all threads, and won’t accept any new orders.
If you want fast and 100% completely sure shutdown, use the now parameter. In 14 years of experience I haven’t faced any bad side of using ‘shutdown now’ vs simple ‘shutdown’.
At this point now you should know the linux command to shutdown your server or local computer, it’s not hard at all, it’s super easy and it takes 2 seconds of your time to turn off, reboot or halt your Linux operating system if you need it.