1. Overview

Power-saving tools can significantly increase the battery life of devices like laptops. Additionally, they may help to reduce heat generation and boost system performance.

In this tutorial, we’ll explore three power-saving tools in Linux.

2. TLP

TLP is a command-line power management tool in Linux. It can optimize the power consumption of various components of the system.

Furthermore, the TLP tool facilitates a diverse range of applications:

  • optimize power settings for laptops to extend battery life
  • dynamically adjust the CPU parameters to reduce power consumption, specifically during idle state
  • manage the power consumption of peripherals
  • provides support for power management of wireless devices
  • prevent overheating by adjusting  necessary system parameters

Now, let’s begin by installing TLP.

2.1. Installation and Start

To install the TLP tool in Debian-based systems, we can use the apt command:

$ sudo apt-get install tlp

Furthermore, on Arch and Arch-derivatives, we utilize the pacman command:

$ sudo pacman -S tlp

Now, let’s verify the installation status of the TLP tool:

$ sudo tlp-stat
--- TLP 1.5.0 --------------------------------------------

+++ Configured Settings:
defaults.conf L0004: TLP_ENABLE="1"
defaults.conf L0005: TLP_WARN_LEVEL="3"
defaults.conf L0006: TLP_PERSISTENT_DEFAULT="0"
defaults.conf L0007: DISK_IDLE_SECS_ON_AC="0"
defaults.conf L0008: DISK_IDLE_SECS_ON_BAT="2"
defaults.conf L0009: MAX_LOST_WORK_SECS_ON_AC="15"
...output truncated...

The output of tlp-stat confirms that we successfully installed the TLP tool in our system.

Next, to use the TLP tool, we need to start it:

$ sudo systemctl start tlp

Alternatively, we can also use the enable option to start the service when the system starts:

$ sudo systemctl enable tlp

At this point, TLP should be active.

2.2. Configuration

Now, we open the TLP configuration file to adjust the power settings of the system based on our needs. It contains power settings for battery, CPU, and wireless devices.

However, to open the TLP configuration file, we must know its path in the system:

$ locate tlp.conf
/etc/tlp.conf

Thus, we’re ready to amend the TLP configuration file. Here, we use the nano editor to open the file:

$ sudo nano /etc/tlp.conf 
...
# /etc/tlp.conf - TLP user configuration (version 1.4)code 
# See full explanation: https://linrunner.de/tlp/settings
ettings are read in the following order:
#
# 1. Intrinsic defaults
# 2. /etc/tlp.d/*.conf - Drop-in customization snippets
# 3. /etc/tlp.conf     - User configuration (this file)
 tlp - Parameters for power saving

# Set to 0 to disable, 1 to enable TLP.
# Default: 1

#TLP_ENABLE=1

# Control how warnings about invalid settings are issued:
#   0=disabled,
#   1=background tasks (boot, resume, change of power source) report to syslog,
#   2=shell commands report to the terminal (stderr),
#   3=combination of 1 and 2
# Default: 3

#TLP_WARN_LEVEL=3
# Operation mode when no power supply can be detected: AC, BAT.
# Concerns some desktop and embedded hardware only.
# Default: <none>

#TLP_DEFAULT_MODE=AC

# Operation mode select: 0=depend on power source, 1=always use TLP_DEFAULT_MODE
# Note: use in conjunction with TLP_DEFAULT_MODE=BAT for BAT settings on AC.
# Default: 0

#TLP_PERSISTENT_DEFAULT=0
...output truncated...

Let’s take a look at some examples of how to enable power-saving options using the TLP configuration file.

In the first example, we enable the wireless power-saving option by modifying the WIFI_PWR_ON_BAT variable in the TLP configuration file:

WIFI_PWR_ON_BAT = 1

Enabling the wireless power-saving option can significantly reduce power consumption while the system is connected to Wi-Fi and Bluetooth.

Furthermore, we can minimize the CPU power consumption by uncommenting the CPU_SCALING_GOVERNOR line in the configuration file and setting it to the powersave option:

CPU_SCALING_GOVERNOR=powersave

Finally, let’s enable the power-saving option when USB devices are attached to a system:

USB_AUTOSUSPEND=1

This command automatically reduces power consumption when the USB devices are attached but not used by the system.

3. powertop

We can use the powertop tool to monitor and analyze the power consumption in Linux. It provides information about the power usage of various hardware components, including the GPU, CPU, and peripherals.

Additionally, the powertop tool facilitates recommendations for optimizing the power consumption in the system.

3.1. Installation

We can install the powertop tool in Debian-based systems using the apt command from the Linux terminal:

$ sudo apt-get install powertop

Additionally, if we want to install the powertop tool on Arch and Arch-derivatives, we use the pacman command:

$ sudo pacman -S powertop

Now, let’s verify the installation status of the powertop tool:

$ powertop --version
PowerTOP version 2.14

Thus, as we can see, the installation is completed.

3.2. Usage

Now, let’s discuss how to utilize the powertop tool in Linux for power-saving purposes.

First, we open powertop, which spawns an interface similar to the process-managing top command:

$ sudo powertop
PowerTOP 2.14     Overview   Idle stats   Frequency stats   Device stats   Tunab
Summary: 943.1 wakeups/second,  0.0 GPU ops/seconds, 0.0 VFS ops/sec and 44.3% C

                Usage       Events/s    Category       Description
              6.6 ms/s     411.5        Timer          tick_sched_timer
             12.7 ms/s     125.0        Interrupt      PS/2 Touchpad / Keyboard 
             99.1 ms/s      12.2        Process        [PID 3385] /opt/google/ch
              2.6 ms/s      48.6        Timer          hrtimer_wakeup
             75.5 ms/s       8.0        Process        [PID 3111] /opt/google/ch
              0.9 ms/s      26.8        kWork          engine_retire
...output truncated...

The output provides a comprehensive overview of the power usage in the system:

  1. time system spent for an event
  2. frequency of event occurrence
  3. type of event
  4. description of an event

Additionally, the output lists the events based on their power consumption. Therefore, we can identify power-hungry events and take appropriate actions to optimize power usage of the system.

Further, the powertop tool provides an option called auto-tune to optimize the power consumption of the system:

$ sudo powertop --auto-tune

The auto-tune option analyzes the power consumption of the events and automatically applies necessary changes, such as tuning various power settings and modifying kernel parameters to reduce power usage.

4. acpitool

acpitool is a command-line utility in Linux that facilitates information about the ACPI (Advanced Configuration and Power Interface) devices. Additionally, it enables the operating system to manage power consumption based on the user activity.

In particular, acpitool can be used for various tasks:

  • thermal management
  • device configuration and enumeration
  • monitoring and management of battery usage
  • handle user interaction
  • monitor ACPI events

Now, let’s take a look at the installation process of acpitool in Linux.

4.1. Installation

For Debian-based Linux distributions, we utilize the apt command to install acpitool from the terminal:

$ sudo apt-get install acpitool

Additionally, for Arch Linux and Arch-derivatives, acpitool can be installed using the pacman command:

$ sudo pacman -S acpitool

Now, let’s check the installation status:

$ acpi --version
acpi 1.7

Copyright (C) 2001 Grahame Bowland.
              2008-2012 Michael Meskes.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

So, we can proceed further as the installation is completed.

4.2. Usage

To begin with, let’s check the thermal states of the system using acpitool:

$ acpitool -t
Thermal 0: ok, 29.8 degrees C
Thermal 1: ok, 27.8 degrees C
Thermal 2: ok, 10.0 degrees C

Next, we can check the CPU information:

$ acpitool -c
  CPU type               : Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz 
  Min/Max frequency      : 400/400 MHz
  Current frequency      : 1181 MHz
  Frequency governor     : powersave 
  Freq. scaling driver   : intel_pstate 
  Cache size             : 1800.000 KB
  Bogomips               : 3600.00 
...output truncated...

Furthermore, we can extract information about batteries using acpitool:

$ acpitool -b
Battery #1     : charging, 80%, 00:45:12 until charged

Thus, using acpitool, we can get information about various components of a system, which can help us to take necessary actions for power saving.

5. Conclusion

In this article, we discussed three power-saving tools in Linux.

TLP is a Linux power management tool specifically designed to optimize the system’s power consumption. Additionally, we can modify the TLP configuration file to enable power-saving for specific system components. On the other hand, the powertop tool is designed to analyze the power consumption of the hardware components of the system. Although it offers an automatic tuning option for power savings, we can’t optimize a specific component of the system.

Finally, using acpitool, we can view the power usage statistics of different components, which can help us take appropriate actions to save power.

Comments are open for 30 days after publishing a post. For any issues past this date, use the Contact form on the site.