POWER-SUPPLY(1)
π POWER-SUPPLY(1) π
okay so bestie, welcome to power-supply(1) β the little script that spills all the tea about your power supply devices πβ¨ she reads straight out of /sys and tells you everything, no cap.
πΈ NAME πΈ
power-supply β query properties of power supply devices π
β¨ SYNOPSIS β¨
power-supply
power-supply [-r] -d <dev> [prop-options] [-d <dev> [prop-options]]...
[-- <cmd...>]
power-supply (-V | -h)
π¦ DESCRIPTION π¦
okay so here's the vibe check π
If you run power-supply with no arguments at all, it prints a list of AC Adapters and Batteries in the format <dev-type>:<dev-idx> <dev-name>. iconic.
dev-typeisadapter(AC Adapter) orbattery,dev-idxis a 0-based ordinal number of the device type,dev-nameis the name of the device (directory) in/sys/class/power_supply.
Then, power-supply invoked with -d and the property option(s) without an argument, prints value(s) of the specified property/ies π«Ά.
And power-supply invoked with -d and the property option(s) with a value argument (conditions), tests if all the specified properties satisfy the specified condition π β like a vibe check but for your battery.
so if cmd is given:
- if conditions are satisfied:
cmdis executed πββοΈ - else: exits with status
0
else (when cmd is not given):
- if conditions are satisfied: exits with status
0 - else exits with status
1π
Also, heads up: property values are converted to lowercase and spaces replaced with hyphens (-), unless --raw is specified. little glow-up, you know how it is π
π OPTIONS π
-d <dev>[:<idx>],--dev <dev>[:<idx>]β Eitherdev-nameof the device under/sys/class/power_supplyordev-typeof the device, optionally followed by a colon anddev-idxβ a 0-based ordinal number (this is the one you want when multiple devices of the same type exist, iykyk).
The dev-type is one of:
adapter,ac, orafor an AC Adapter (Mains),battery,batorbfor a Battery.
-r,--rawβ Output (or compare) property values as-is, no lowercasing, no space-to--swap. raw and unfiltered, main character energy π₯--allβ Print all properties of the device in the format:<prop> <value>. it's giving full transparency π--<prop>β Print value of the device propertyprop(hyphens will be replaced with underscores).--<prop> [!]<value> | <start>-<end>β Specify condition on the propertypropβ it can be a value (<prop> = <value>), a value prefixed with!(<prop> != <value>) or an inclusive integer range (<prop> -ge <start> && <prop> -le <end>) π-V,--versionβ Print script name & version and exit.-h,--helpβ Show the help message and exit.
π AC Adapter options
-s [[!]<value>],--status [[!]<value>]β Alias for--online. Valid values are:offline,online(or0,1if--raw). π‘
π Battery options
-s [[!]<value>]β Alias for--status. Valid values are:unknown,charging,discharging,not-charging,full.-c [[!]<value> | <start>-<end>]β Alias for--capacity. Valid value is integer between0and100.-C [[!]<value>]β Alias for--capacity-level. Valid values are:unknown,critical,low,normal,high,full.
π EXIT CODES π
0β Clean exit, no error has encountered. slay β¨1β The conditions were not satisfied (see DESCRIPTION for more information). π100β Invalid usage.101β The device was not found or has unsupported type.102β The device does not provide the requested property or failed to read it.
Ifcmdis given and the conditions are met,power-supplyexits with the exit status of thecmd. fr fr, she hands the mic over π€
π§ FILES π§
/sys/class/power_supply/*β The directory where the devices and properties are read from. that's the source of truth bestie π
π EXAMPLES π
List all AC Adapters and Batteries found in /sys/class/power_supply
$ power-supply
adapter:0 AC
battery:0 CMB1
battery:1 hidpp_battery_38
Print all properties of Battery 0
$ power-supply -d battery:0 --all
alarm 0
capacity 30
capacity_level normal
cycle_count 19
energy_full 56570000
energy_full_design 57020000
energy_now 17080000
manufacturer smp
model_name 5b10w139
...
Print the current capacity of Battery 0
$ power-supply -d bat --capacity
95
Exit with status 0 if AC Adapter 0 is online, 1 if it's offline
$ power-supply -d adapter -s online
Run command doas zzz -H if AC Adapter 0 is offline and Battery 0 has capacity below 11 %
$ power-supply -d ac -s offline -d bat -c 0-10 -- doas zzz -H
like, the range 0-10 is inclusive so 10 counts too, okurrr π
π AUTHORS π
Jakub Jirutka
π€ REPORTING BUGS π€
Report bugs to the project's issue tracker at https://github.com/jirutka/acpi-utils/issues. don't be shy, she wants to hear from you π«Ά
and that's the whole page bestie π β written up and dated 2021-10-19, packed into the POWER-SUPPLY(1) page, from the acpi-utils fam. go forth and query those power supplies πβ¨π·
π¦ where this page comes from
- alpine 3.24: acpi-utils-doc 0.1.0-r0 Β· MIT
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms