20

I'm up to reinstall Arch on my laptop while I have a bit of a time and I've encountered an interesting question to ask.

Is there any way to check my laptop battery status without installing acpi package? (as I'm currently offline without charger and I can't get neither of them)

I thought that system should keep track of a battery level somehow. So is it possible to display that info in CLI?

1
  • 4
    Have a look at the files in /sys/class/power_supply/. May or may not work for your particular hardware.
    – dirkt
    Feb 5 '17 at 11:15
25

The kernel provides this information through /sys/class/power_supply/BAT0/capacity

Simply cat this path to get the information (in percent of your batteries capacity):

cat /sys/class/power_supply/BAT0/capacity

For an live view you can combine cat with the command watch. The following command provides you an, updated, live status of your batteries capacity:

watch -n0 cat /sys/class/power_supply/BAT0/capacity

If your system has more then one battery, BAT0 under /sys/class/power_supply/ maybe BAT1, BAT2 or something different. Look at the devices under ls /sys/class/power_supply/ and cat their information.

1
  • I use Alpine Linux and in power_supply I have AC (Alternate Current) and CMB1 using my Laptop.CMB1/capacity shows 95. Thanks for the watch command, 0 is the seconds.
    – Timo
    Nov 18 '20 at 8:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.