CentOS

How to Check Laptop Battery Status on CentOS 8

How to Check Laptop Battery Status on CentOS 8

This article is about different ways of checking laptop battery status on CentOS 8. CentOS 8 is a Linux distribution in which GUI users can check the battery status by pointing the mouse at the battery icon in the status bar. Whereas, the command-line users have to write commands to check the status of the battery. Although, it is not difficult to check battery status on Linux distributions. But, for most beginners, it can look like a demanding task.

In this article, we are going to learn commands or methods to check battery status on a CentOS 8.

There are different methods available to check battery status on CentOS 8.

Check battery status using the Upower command

You can use the Upower command to check the battery status. In most Linux distributions, this command is preinstalled. Open the terminal and execute the below-mentioned command:

 $ upower -i /org/freedesktop/UPower/devices/battery_BAT0

The output of the above command does not only show battery status but also detailed information about the battery such as vendor name, voltage, serial number, etc.

As visible from the above output, the battery charging of the system is 95%. This command also displays other information related to the battery.

When you only want to see battery status without detailed information, use the Upower command in combination with the grep command as follows:

$ upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -i "state\|percentage\|time to empty"

The above output only shows the battery charging status. Battery charging is 99% in the above-displayed output at that time.

For more details about the Upower command, visit the man pages.

$ man upower

Display Laptop battery status through Sysfs File system

The ‘Cat’ and ‘Find’ commands are another easy method to check battery status using the sysfs file system.

Using the sysfs file system, user can easily display the battery charging status by using the following command:

$ cat /sys/class/power_supply/BAT0/capacity

As visible from the above output, the battery level of our system is 100%. If you also want to see details of the power supply, you can use the ‘Find’ command. Run the following command on your terminal.

$ find /sys/class/power_supply/BAT0/ -type f | xargs -tn1 cat

As evident from the above-given output, the” Find” command displays different details of the battery such as design, model name, manufacturer, etc.

Check laptop battery status through GUI environment

To check the laptop battery status, go into the system setting and choose the ‘power’ option from the left sidebar, which is shown in the following screenshot:

In the above-displayed output, you can see the battery status of your laptop.

Conclusion

We have discussed different methods in this article for checking the battery status on CentOS 8. All the above methods are useful and easy for beginners. After reading this article, I hope now you can easily check your laptop battery status on CentOS 8 distribution.

Similar Posts