TLP is a free, open-source and feature rich utility for battery use optimization on laptops running Debian and other Linux distros. You can find it in both CLI and GUI versions for whatever suits you. TLP comes with a default configuration which is pretty much perfectly tuned for your OS and the underlying machine. All you need to do is to install and enable the utility and you are good to go. The utility works by optimizing the power used by hardware devices while your laptop is running on its battery rather than on AC.
In this article, we will explain how to enable TLP on your Debian machine in order to save battery power through:
- TLP Command Line Interface
- TLP User Interface Utility
We have run the commands and procedures mentioned in this article on a Debian Buster 10 system.
Install and use the TLP CLI
Open your Debian command line, the Terminal, easily through the system Application Launcher search. Press the Super/Windows key and you can search for Terminal in the search bar as follows:
The next step is to update your system’s repository index through the following command:
$ sudo apt-get update
This helps you in installing the latest available version of a software from the Internet.
Please note that only an authorized user can add, remove, and configure software on Debian. Please enter the following apt-get command as sudo or root user in order to install TLP on your system:
$ sudo apt-get install tlp
The system might prompt you with a y/n option to continue installation. Please enter Y if you want to continue with the installation. The process might take some time, depending on your Internet speed, after which TLP will be installed on your system.
You are now ready to use TLP. Let us first see how to start the utility through the following command; the command starts the TLP service on your system:
$ sudo tlp start
You following TLP command lets you view detailed system information and also the status of the TLP utility:
$ sudo tlp-stat -s
TLP, by default, starts in a preset configuration that is pretty much best suited for your operating system and hardware. You can view this configuration through the following command:
$ sudo tlp-stat -c
Another very useful command is to print the detailed battery report through TLP. Use the b flag with the tlp-stat command to view this information:
$ sudo tlp-stat -b
If you ever feel like removing this utility from your system, you can do so through the following command as sudo:
$ sudo apt-get remove tlp
Enter y on the y/n prompt and the software will be completely removed from your system.
Install and Use the TLP UI
For a person who is more into the UI, there is a user interface available for the TLP utility. Let us learn how to install it through the command line by using the deb package from github.
Note: Before installing the TLP UI, please make sure that the TLP utility is already installed and running on your system.
These are some prerequisites that you will need in order to clone and then build the deb package (that we are going to download next through git):
$ sudo apt-get install python3-gi git python3-setuptools python3-stdeb
Then, using the git command, download the TLPUI package from github as follows:
$ git clone https://github.com/d4nj1/TLPUI
Next, move to the download TLPUI directory and build the deb package as follows:
$ python3 setup.py --command-packages=stdeb.command bdist_deb
The last step is to install the deb package through dpkg as follows:
$ sudo dpkg -i deb_dist/python3-tlpui_*all.deb
The process might take some time, depending on your Internet speed, after which the TLP UI will be installed on your system.
You are now ready to launch and use the utility. Enter the following command in the Terminal.
$ tlpui
This is how the TLP UI looks like. The Configuration tab lets you view and edit the TLP settings. Whereas, the Statistics tab lets you view system and battery use statistics.
The most important button here is the TLP-ENABLE slider On and Off button. Through this button, you can enable/disable battery optimization through TLP, based on your configuration. Please make sure to save the changes to the TLP configuration file by using the Save option from the File menu.
If you ever want to remove the utility from your Debian installed through this method, you can do so by entering the following command in your Terminal:
$ sudo dpkg -r python3-tlpui
So these were two ways through which you can use battery on your Debian system is the most efficient manner. As soon as you enable the TLP service, you will start noticing that your battery life will be prolonged, which is otherwise a frequently encountered problem with laptops running Linux.