I'm new to Linux (using Raspbian) and Raspberry Pi, and I'm wondering which of the two commands mentioned in the title that I should use when powering off my Pi. I googled them but still don't really get the difference between the two, does it matter which one I use?
man shutdown. The man pages give you a complete list of the options that a command can take, and an explanation of what they do. In the case of
-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.
The difference between including the
-h option or not, is slight, and is irrelevant in this case, as you can't poweroff the Pi anyway, not without manually removing the USB power.
The documentation is in
-P, --poweroff Power-off the machine (the default). [...] -h Equivalent to --poweroff, unless --halt is specified.
Sometimes commands have redundant seeming switches like this because they must satisfy specifications for several different contexts. Simple logic tells us that since
poweroff is the default anyway, using
-h is itself redundant (again, it exists to satisfy an external spec; some implementations of
shutdown may not work this way by default, but all the ones that conform will implement
Since the pi itself can't poweroff (it is either plugged in == on, or not), there is no point in using
poweroff, but it won't cause any harm. It may make a difference WRT the way the red LED blinks at the end (you could compare with
shutdown -H to see). Note the major purpose of
shutdown is to stop (halt) the OS from running.
So you can use either form.
1. This one is actually from Raspbian jessie and comes with systemd; it is slightly different from the shutdown in Raspbian wheezy (Greenonline's answer quotes that), which is an example of what I mention in the next paragraph about different implementations meeting the same specification. The shutdown process is actually part of the init system, which is SysV on wheezy and systemd on jessie.