2

I just realized that /usr/bin/poweroff and /usr/bin/shutdown are symbolic link to systemctl, but I don't know how systemctl is being run.

so is there any difference between /usr/bin/poweroff and /usr/bin/shutdown?

EDIT: when I call any of these two programs, systemctl is being executed but I don't know what command/parameter is passed to systemctl.

when I type systemctl --helpthere are two options that may come into play

  • halt Shut down and halt the system
  • poweroff Shut down and power-off the system

but something tells me that both poweroff and shutdown are the same in here (I'm guessing)

I'm running Archlinux

1 Answers1

1

In most systems, every "shutdown" command is just a symlink to a common program/script which changes its behaviour based on how (with which "name") is invoked.

So, poweroff does a kind of shutdown which powers off the machine (usually via ACPI APIs), too and it's equivalent to shutdown -hP, while shutdown as a command is more generic and can do many thigs after "stopping" the OS, based on with which flags is called.

For example shutdown -r reboots the machine while shutdown -h just stops the OS (and the machine is still powered on, while not usable).

Daniele Santi
  • 4,137
  • 2
  • 30
  • 30
  • It's an oversimplification to say that poweroff is equivalent to shutdown -hP. It's equivalent to that in the van Smoorenburg toolset, but in the systemd toolset both the -h and -P options are the defaults anyway and it is equivalent to plain shutdown now. The now is important, by the way. https://unix.stackexchange.com/a/196471/5132 https://unix.stackexchange.com/a/465337/5132 – JdeBP Sep 05 '18 at 17:15
  • @JdeBP I agree the now is important (as +mmm minutes, btw) but the OP was asking about differences, not syntax ;) – Daniele Santi Sep 05 '18 at 18:38
  • right, but as far as I can see both programs are a symlink to systemctl, I don't see how systemctl is being used. What makes it interesting is that those flags mention here have not use with systemctl – juanp_1982 Sep 05 '18 at 23:20
  • now is important because without it there is a difference. Pay close attention to the user manual of the systemd toolset. – JdeBP Sep 06 '18 at 00:44