2 minutes
TIL: how to shutdown properly
I’m an idiot.
I probably shouldn’t be admitting to this, but today I found my new 12th-Gen Framework laptop had drained its battery whilst completely shutdown. This wasn’t the first time in hindsight.
So I started searching through the interwebs and found various discussions about battery issues with the 11th-Gen, and came across this thread.
This post in particular caught my attention:
$ sudo shutdown -H -P +0
-H
= halt-P
= power off+0
= nowThe syntax of shutdown changed with systemd. Some things still us OLD methods
$(shutdown -h now)
, which doesn’t always do the things on NEW hardware.
For some context, I’m experimenting with a Sway setup on my laptop. For years now I’ve been running Gnome so usually when I’m shutting down my desktop or laptop it’s with a click of a button in a UI.
Over the years whenever I’ve had to shutdown a server or a VM I’ve always used shutdown -H now
. I don’t remember learning
this, it’s just muscle memory by now.
So for the last couple weeks when I’ve been shutting down my laptop, I’ve been using shutdown -H now
, as Sway doesn’t have
a button for the likes of idiots like me.
Colour me surprised when I checked the man page (for the first time) of shutdown
:
OPTIONS
The following options are understood:
--help
Print a short help text and exit.
-H, --halt
Halt the machine.
-P, --poweroff
Power the machine off (the default).
-r, --reboot
Reboot the machine.
-h
The same as --poweroff, but does not override the action to take if it is "halt". E.g. shutdown --reboot -h means "poweroff", but shutdown --halt -h means "halt".
Have you noticed it yet?
I’m guessing you already knew and are looking at the screen in disgust thinking I’m a fucking idiot and should be thoroughly ashamed of myself (I am 😢).
For those like me who didn’t know:
shutdown -H now
halts the system without delayshutdown -h now
halts the system and POWERS IT OFF! without delayshutdown now
ALSO halts the system and powers it off without delay, since-P
is the FUCKING DEFAULT!
All these years I could have been typing less characters and having the desired effect… 😅
This has been your monthly reminder that knowledge without understanding is about as useful as a concrete parachute.