Using Bash to monitor battery life and optimize it

In this article, we will learn about the TLP Linux tool. TLP is a command-line tool; it is used for power management and will optimize the battery life.


Besides having a Terminal open, you need to ensure that you have TLP installed on your system.

How to do it

TLP’s configuration file is in the /etc/default/ directory and the filename is tlp. After installation, it starts as a service automatically. We can check whether it’s running under system by running the systemctl command, as follows:

$ sudo systemctl status tlp

Run the following command to get the operation mode:

$ sudo tlp start

To get the system information as well as TLP status, run the following command:

$ sudo tlp-stat -s

To view TLP configuration, run this command:

$ sudo tlp-stat -c

To get all the power configurations, run the given command:

$ sudo tlp-stat

To get the battery information, use this command:

$ sudo tlp-stat -b

To get the fan speed and temperature of the system, run the next command:

$ sudo tlp-stat -t

To get the processor data, run the following command:

$ sudo tlp-stat -p

How it works

TLP is a command-line tool that comes with automated background tasks. TLP helps in optimizing the battery life in laptops powered by Linux.

We get information about the battery life, processor data, temperature, and fan speed by running sudo tlp-stat with various options. tlp-stat shows the power management setting. The options we used with tlp-stat are as follows:

  • -b: Battery
  • -t: Temperature
  • -p: Processor data
  •  -c: Configuration
  •  -s: System information


Submit a Comment

Your email address will not be published. Required fields are marked *

two × 2 =

Related Articles