Checking up on your laptop's battery usage is highly recommended to maintain long battery life and charging. While the battery icon in your taskbar might show the battery charging status, capacity, and predicted time of discharge, it will not give any information about battery usage and its lasting effect on battery's life.
Here at Ibmi Media, as part of our Server Management Services, we regularly help our Customers to perform related Linux System Monitoring queries.
In this context, we shall look into utilities to get detailed battery information on Linux Mint 20.
1. TLP
TLP is a command-line battery optimization tool. To install TLP use the following command:
$ sudo apt install tlp
You can check battery information by running the following command:
$ sudo tlp-stat -b
Remember to run TLP commands with root or sudo privileges.
To view more information, Run the following command:
$ sudo tlp-stat -s
You can also explore other options of tlp-state command by running the "tlp-stat -h" or "man tlp-stat".
2. ACPI
ACPI is a command-line tool that fetches battery and thermal information from the file system such as /proc and /sys.
Run the following command to install the ACPI tool:
$ sudo apt-get install acpi
You can get summary information about the battery by running the following command:
$ acpi -i
To get more detailed battery information, run:
$ acpi -V
To query other specific options of acpi command, run the "acpi -h" or "man acpi".
3. Sysfs File system
The files in the sysfs file system contain information about devices, filesystems, and other kernel modules.
You can see the battery information in the sysfs file system by running the following command.
$ cat /sys/class/power_supply/BAT0/*
4. upower
upower is a command-line tool that contains information about power sources on the system.
First, you have to select the path your power source is using. To see different power sources and their paths, run:
upower -e
For laptops, your battery source would have a path ending in pattern BAT0, BAT1, or BAT2. Next copy that path and run the following command to see battery information:
$ upower -i <your power source path>
Alternatively, you can make use of the BAT pattern and run the following command to get the same results:
$ upower -i `upower -e | grep 'BAT'`
Get all upower options by running "upower -h" or "man upower".
5. Power statistics
Power statistics is a graphical user interface tool that comes installed in Linux Mint and provides a detailed analysis of our battery usage.
To run Power statistics, search for power statistics in your applications and click on the power statistics icon.
Go to the Laptop Battery in the sidebar. The window will display the battery details.
The history tab will show the battery analysis based on your battery history. You can see different analyses by changing the graph type.
The statistics tab will show the charge and discharge profile and accuracy of the current battery.
This article covers the different methods to check your battery health monthly to keep its charging cycle and usage optimized. For this purpose, you can use the "acpi" command.
The acpi command shows battery status and other ACPI information in your Linux distribution.
You might need to install acpi command in some Linux distributions.
On Arch Linux and its derivatives:
$ sudo pacman -S acpi
To install acpi on Debian, Ubuntu and its derivatives:
$ sudo apt-get install acpi
On RHEL, CentOS, Fedora:
$ sudo yum install acpi
Or,
$ sudo dnf install acpi
Once acpi installed, run the following command:
$ acpi -V