Today, we will explore how to monitor the power usage on Linux using different ways. We will first see how it can be achieved via Graphical User Interface (GUI). Then, we’ll make use of the Linux command line to achieve the same. We will also discuss some methods to optimize the power usage on a Linux system. In this tutorial, we demonstrate the steps on an Ubuntu 22.04 system. The commands that are used in this guide are simple. And the tools that we use can be easily installed in Ubuntu 22.04. Most of the methods discussed here can be replicated on almost all Linux distributions.
Let’s get started!
The following are the steps that we will follow in the given order to understand how we can monitor the power usage as well as optimize it:
Monitor the Power Usage via GUI
Let’s begin by monitoring the power usage on Linux with the help of Gnome’s Power Statistics tool. This tool can be installed via the command line.
Install Gnome Power Statistics Tool
Here, we will see how we can install the Power Statistics tool using the Ubuntu’s command line by running a Linux command. Before installing the Power Statistics, update the system with this command:
Next, install the tool by executing the following command:
After this, the tool will be successfully installed and is ready to use.
View Power Statistics
Let’s now start using the tool. Go to the start menu. Type “Power Statistics” in the search bar and hit enter. Once you locate the application, tap to run it.
This is how the tool’s interface appears. You will see AC adapter details as shown in the following image:
To see the laptop battery’s power statistics, click on the “Laptop Battery” in the left panel.
Monitor the Power Usage through Ubuntu’s Command Line
In this section, we list a few ways to monitor the power usage using the Ubuntu’s command line.
Method 1: Upower Utility
To monitor the power usage using Upower utility, execute the following command:
Method 2: ACPI Utility
First of all, install the acpi if it is not installed in your system.
To monitor the power usage using acpi utility, issue the following command:
You can run the acpi command with the options that were mentioned previously to get the information on a particular resource.
Method 3: Batstat
First, we install the Batstat in our system and configure it. To do that, follow these commands:
Now, run the batstat command to monitor the power usage statistics:
How to Use Less Power on a Linux System
In this section, we will discuss some of the ways in which we can optimize the power usage on a Linux system.
Method 1: Limiting the Screen Brightness
High brightness takes a good toll on your system’s power usage. If you adjust the brightness to the lowest level, you will feel the difference in the power that is utilized by your system. Brightness can be adjusted by tapping on the top-right of your screen where you can see the information like battery, wifi, and sound.
The following window opens where you can adjust the brightness:
Method 2: Limit the USB Devices
A plugged USB device derives power from your system’s power resources. To optimize your system’s power usage and battery life, keep your plugged usb devices to a minimum number.
Method 3: Enable TLP
TLP is an open source utility that is used for power optimization in a Linux system. To install TLP, run this command:
Once it is installed, start the utility like this:
You will see the following output after running the command:
To see the system and power statistics using TLP, issue the following command:
Method 4: Disable the Screensavers
You can also optimize the power usage by disabling the screen savers as they are heavy on the system.
Execute this command to disable the default screensaver:
This setting is temporary as it disables the screensaver for the current login session only.
To permanently disable the screensaver, changes in the “.xsession” file have to be made. To make changes, open the file first with the nano editor like in the following:
Now that the file is open, add the following line:
Once the line is added, save the file and reboot your system.
Method 5: Using Lightweight Software
You can make use of a power usage monitoring tool to keep a check on the software that are more resources hungry. Once you find out the heavy software on your system, you can get rid of them and shift to their alternatives that are lighter and don’t become a burden on the system’s power resources.
We can make use of the powertop utility to monitor the power usage statistics on our system. It can be installed using the following command:
To inspect the power usage statistics, run the following command:
In today’s guide, we learned in detail on how we can monitor the system resource usage with the help of different tools. After exploring the different tools and utilities, we also dived into the solution on how to optimize the power usage on a Linux system using the various doable methods. The methods that we followed are very easy and create a great impact on the system’s performance and efficiency by carefully making use of the system’s resources and driving less power.
We hope you liked the tutorial.