Easily Set Charging Thresholds For ASUS Laptops On Linux Using bat

asus battery charging stop threshold linux

bat is a simple command line tool for easily setting and checking the ASUS battery charging stop threshold (for laptops that support this), in order to help extend battery life.

According to its wiki, bat aims to "replicate the functionality ASUS Battery Health Charging utility for ASUS laptops on Windows which aims to prolong the battery's life-span".

I've already covered how to limit battery charging (set a charge threshold) for ASUS laptops on Linux, but with the help of this tool, you'll be able to easily change the charging threshold, reset it, and see the current charging threshold level. bat can also print the current battery level and charging status.

Under the hood, bat uses systemd services in order to make the battery charging threshold level persists between restarts and after waking from hibernation. To use bat, you'll need systemd 244 or newer (e.g. Ubuntu 20.04 and newer, Debian Bullseye and Sid, Fedora 32 or newer, openSUSE Leap 15.3, etc.), Bash and at least Linux 5.4, but for some newer ASUS laptops you'll need a newer kernel (more on that in the link below).

Please check out my initial article on limiting battery charging for ASUS laptops for more details. I also recommend following the initial steps from that article (don't create the systemd service; if you have, stop and disable it using sudo systemctl stop battery-charge-threshold; sudo systemctl disable battery-charge-threshold) in order to make sure your ASUS laptop actually supports limiting battery charging on Linux. Not all ASUS laptops support setting a battery charge threshold so depending on your ASUS laptop model, this may or may not work for you; there's no list of supported devices that I could find.

[[Edit]] This might not work properly (not set the charging threshold) after resuming from suspend in some cases (so far only reported on Ubuntu). Bug report here.

You might also like: 3 Tools To Display Linux Laptop Battery Information From the Command Line


Install and use bat to limit battery charging for ASUS laptops on Linux


To use bat, start by installing the binary available on its GitHub releases page. Download the file called "bat" and place it in your home folder. Then open a terminal and install it to /usr/local/bin using the following command:

sudo install bat /usr/local/bin

In case you already have a binary called bat (e.g. bat), rename bat to something else.

To use bat to show the current charging threshold limit, use -t or --threshold:

bat -t

If you've never set a battery charging threshold, this command should output "100", meaning that the battery will fully charge.

To set a battery charging stop threshold using bat, use:

sudo bat -t <CHARGE_THRESHOLD>

E.g. to only charge the laptop battery to 60% and then stop charging, use:

sudo bat -t 60

By default, this new battery charging threshold is only used for the current session, and is reset upon rebooting the system. To make the change permanent, use -p or --persist:

sudo bat -p

If you want to revert this, and only use the current charge threshold for the current session (prevent it from persisting after a system restart), use -r or --reset:

sudo bat -r

When you want to get rid of any battery charging thresholds, and allow the ASUS laptop to charge completely (to 100%), simply set the threshold value back to 100 using:

sudo bat -t 100

bat can also show the current battery level (-c or --capacity), and print the charging status (-s or --status).

You might also be interested in: How To Get The Numpad Embedded Into The Touchpad Of Some ASUS Laptops To Work On Linux