Difference between shutdown options [duplicate]

I'd like to know what the difference is between shutdown -H (halt the machine) and shutdown -P (poweroff the machine). I understand what poweroff means; it's rather self-explanatory. But what exactly is "halt"?

Background: I need to turn off my PC with a terminal-command because otherwise the shutdown/reboot hangs.

I found the command shutdown -H -P +0 here. It seems to be combination of the two options and it really works fine.

P.S. I have Lubuntu 18.04.2, 64 bit


Make it easy and use the command

poweroff

It works with my Lubuntu 18.04 LTS.

halt means flush buffers, unmount drives, close all processes in a graceful way. But not power off (though some systems may power off anyway). So the hardware is still provided with power.

After halt a hard power off (pressing the power button or unplugging the power supply) will not damage the system, because it is already halted in a graceful way.


From the man page of shutdown:

-H

Requests that the system be either halted or powered off after it has been brought down, with the choice as to which left up to the system

Halted here means it is going to wait for a user action. That can be pressing the power down button and holding it to stop the machine. But also pressing a key that would restart the machine. That can be useful if you want to enter BIOS of the machine.

-P

Requests that the system be powered off after it has been brought down.

+0

it the time it has to wait in minutes

So... -P can, depending on the system, already be part of the -H option. You need the -P if the -H does not power down by itself. What actually happens is part of ACPI and the implementation of it can be buggy so for some it works for others not so ... The general idea when giving a solution is to try to cover all the bases and that would be to use both: -H and -P.