×


Methods to check the status of laptop battery on Ubuntu 20.04 LTS ?

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.


How to View the battery report using the Ubuntu UI ?

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.


How to view the battery report using the Ubuntu Command Line ?

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:

man upower

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

acpi –V

To view the details on a battery charge, use:

acpi

To check the cooling information of your battery, use:

acpi –c

You can check if AC power is connected using:

acpi –a

To learn more about acpi, use:

man acpi

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


About Sysfs File system

The sysfs file system provides information on kernel modules, devices, and other kernel components.

To view battery information, run:

cat /sys/class/power_supply/BAT0/*


[Need urgent assistance with Ubuntu Software Installation and Configuration? We are available to help you. ]


Conclusion

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