Here is a clean, markdown-formatted guide ready to copy and paste directly onto your blog. It uses the 70% to 90% thresholds you requested as the example.
How to Limit Battery Charging on Ubuntu Linux (Step-by-Step)
Keeping your laptop plugged into a charger at 100% capacity constantly can degrade the battery over time. By setting charge thresholds, you can command your system to stop charging once it hits a healthy maximum limit (e.g., 90%) and only resume charging when the battery drops below a minimum threshold (e.g., 70%).
Here is how to set this up using TLP, the ultimate Linux power-management tool.
Step 1: Install TLP
Open your terminal (Ctrl + Alt + T) and run the following command to update your package list and install the core TLP service:
sudo apt update && sudo apt install -y tlp
Step 2: Configure Your Charge Limits
Next, you need to edit TLP's main configuration file to set your custom thresholds. Open it using the terminal's text editor:
sudo nano /etc/tlp.conf
Use your arrow keys to scroll down, or press Ctrl + W to search for THRESH.
Locate the following lines, remove the # symbol from the beginning of each line to uncomment them, and set your desired values:
START_CHARGE_THRESH_BAT0=70
STOP_CHARGE_THRESH_BAT0=90
Use code with caution.
(Note: BAT0 is the default battery name for most laptops. If you have a dual-battery laptop like a Lenovo ThinkPad, repeat this step for START_CHARGE_THRESH_BAT1 and STOP_CHARGE_THRESH_BAT1).
- Save and exit the file by pressing Ctrl + S and then Ctrl + X.
Step 3: Start and Enable the TLP Service
To activate the new limits and make sure they apply every time your laptop boots up, run these three commands:
sudo tlp start
sudo systemctl enable tlp.service
sudo systemctl start tlp.service
Use code with caution.
Step 4: Verify Your Configuration
To ensure everything was configured correctly and to verify that your laptop hardware supports software-level thresholds, run the battery status command:
sudo tlp-stat -b
Use code with caution.
Look at the end of the output. It should show your new limits active:
• Charging start threshold: 70%
• Charging stop threshold: 90%
⚠️ Important Hardware Limitation
Battery thresholds rely heavily on your laptop's physical charging controller and Linux kernel support.
• This feature works flawlessly out-of-the-box on most Lenovo ThinkPads, ASUS, and Dell laptops.
• If sudo tlp-stat -b displays a message stating that charging thresholds are not supported or unsupported, your specific laptop manufacturer may require a dedicated BIOS configuration instead of software intervention.
Check my other post on How to check your Linux PC battery capacity
Follow for more content like this!

Top comments (0)