It is important to check up on your laptop's battery often, after all, your battery is what makes your laptop portable. When new, batteries run longer, but over time, it may not be the case. If not looked after properly, your battery may drain faster due to poor usage.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform several Ubuntu related tasks.
In this context, we shall look into how to use Ubuntu 20.04 to create detailed battery usage reports.
You can view your battery report through the UI using Power Statistics. This a very helpful tool that lets you see how much power you use, along with the different trends
The Power Statistics tool comes installed with most Linux distributions, if you don’t have it, you can install it using Ubuntu Software.
i. To install it using the gnome-power-manager package using the command:
sudo apt-get install gnome-power-manager
You can look for the Power Statistics tool using the Applications Menu.
ii. Search for Power Statistics.
iii. Click the Power Statistics icon. This will take you to the tool.
iv. Click on Laptop Battery to view details.
To view battery history, switch to the History tab. You can view different graphs here by selecting the graph type and data length.
The Statistics tab shows graphs for charge profile, charge accuracy, discharge profile, and discharge accuracy.
1.You can use upower.
To do this, execute the command below:
$ upower -i `upower -e | grep 'BAT'`
The command shows all the battery details including the model, vendor, serial number, voltage, state, and so on.
Another command that shows similar results is:
upower -i /org/freedesktop/UPower/devices/battery_BAT0
To learn more about upower, use:
This will take you to the upower manual where you can view all the different options and their descriptions.
2. You can also use acpi
Another command that you can use is the acpi command. You may need to install it first. The command for installing acpi is:
sudo apt-get install acpi
To view battery details, run
To view the details on a battery charge, use:
To check the cooling information of your battery, use:
You can check if AC power is connected using:
To learn more about acpi, use:
This will take you to the acpi manual where you can view all the different options and their descriptions.
3. You can use TLP
Another tool is TLP. It is free and open-source. To download TLP, use:
sudo apt install tlp
To view battery related information, use:
sudo tlp-stat –b
To view more information, use:
sudo tlp-stat –s
The sysfs file system provides information on kernel modules, devices, and other kernel components.
To view battery information, run:
This article will guide you on different methods to view detailed information on your battery using both the #command line and UI.
To check your #battery health you'll want to open the app, click on the relevant battery item in the sidebar, and double-check that you're faced with the Details tab.
1. Use upower command to check battery status from command line:
Type the following command:
$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
2. Displaying #Linux Laptop Battery Status Using the apci #terminal command
The acpi command may not be installed by default so use apt-get command or yum command to install the same:
$ sudo yum install acpitool
3. Use /proc/acpi/ directory to get laptop battery info (deprecated method)
You can browse the same data by visiting /proc/acpi/ directory:
$ cd /proc/acpi/
$ ls -l