What is the difference between shutdown and poweroff commands?
The answer is in the poweroff(8) man page:
When called with --force or when in runlevel 0 or 6, this tool invokes the reboot(2) system call itself and directly reboots the system. Otherwise this simply invokes the shutdown(8) tool with the appropriate arguments.
A bit of explanation:
The reboot() system call is the kernel function used to reboot, halt or poweroff the machine. It is called
reboot
for historical reasons, but performs all three functions, depending on parameters that are passed to it.The difference between
halt
andpoweroff
is that inhalt
mode the control is returned to a "ROM monitor" (think BIOS), whereaspoweroff
simply powers the system board off. (I have never seen this distinction in effect on PC architectures; on Sun machines it's different, though.)So, when the
poweroff
program is invoked when the Linux system is in runlevel 0 or 6, it will immediately power off the system via thereboot(RB_POWEROFF)
system call.In any other case,
poweroff
will just behave as an alias forshutdown now
.