To turn off my system, I can use one of these three commands:
sudo halt
Or:
sudo poweroff
Or:
sudo shutdown -h now
What are the differences between these commands, or are they all just aliases of each other?
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It only takes a minute to sign up.
Sign up to join this communityhalt
terminates all processes and shuts down the cpu.
poweroff
is exactly like halt
, but it also turns off the unit itself (lights and everything on a PC). It sends an ACPI command to the board, then to the PSU, to cut the power.
shutdown
is like poweroff
, but it also runs shutdown scripts which should stop things gracefully. Examples include giving programs a chance to close files, delete their lock files and unmount drives properly.
Sources:
https://serverfault.com/questions/191537/shutdown-what-is-difference-between-power-off-and-halt
http://osdir.com/ml/os.solaris.managers.summaries/2001-10/msg00027.html
A comment by Peter White
Raspbian
which is stillinit
basedreboot
andpoweroff
are links tohalt
.shutdown
is different (the differences described in the answers).Ubuntu MATE
for the Pi2 issystemd
based and all 4 are links to/bin/systemctl