Understanding Shutdown, Poweroff, Halt and Reboot Commands in Linux

[‘

n

In this article, we will explain to you the difference between shutdown, poweroff, halt and reboot Linux commands. We will make clear what they actually do when you execute them with available options.

n

If you are hoping to dive into Linux server administration, then these are some of the important Linux commands you need to fully understand for effective and reliable server administration.

n

Normally, when you want to turn off or reboot your machine, you’ll run one of the commands below:

n

Shutdown Command

n

shutdown schedules a time for the system to be powered down. It may be used to halt, power-off or reboot the machine.

n

You may specify a time string (which is usually “now” or “hh:mm” for hour/minutes) as the first argument. Additionally, you may set a wall message to be sent to all logged-in users before the system goes down.

n

Important: If the time argument is used, 5 minutes before the system goes down the /run/nologin file is created to ensure that further logins will not be allowed.

n

Examples of shutdown commands:

n

# shutdownrn# shutdown nowrn# shutdown 13:20  rn# shutdown -p nowt#poweroff the machinern# shutdown -H nowt#halt the machinettrn# shutdown -r09:35t#reboot the machine at 09:35amrn

n

To cancel a pending shutdown, simply type the command below:

n

# shutdown -crn

n

Halt Command

n

halt instructs the hardware to stop all CPU functions, but leaves it powered on. You can use it to get the system to a state where you can perform low level maintenance.

n

Note that in some cases it completely shuts down the system. Below are examples of halt commands:

n

# halttt   #halt the machinern# halt -pt   #poweroff the machinern# halt --reboot    #reboot the machinern

n

Power off Command

n

poweroff sends an ACPI signal which instructs the system to power down.

n

The following are examples of poweroff commands:

n

# poweroff   t       #poweroff the machinern# poweroff --halt      #halt the machinern# poweroff --reboot    #reboot the machinern

n

Reboot Command

n

reboot instructs the system to restart.

n

# reboot            #reboot the machinern# reboot --halt     #halt the machinern# reboot -p   t    #poweroff the machinern

n

That’s all! As mentioned earlier on, understanding these commands will enable to effectively and reliably manage Linux server in a multi-user environment. Do you have any additional ideas? Share them with us via the comments section below.

n

‘]