Exercise: Viewing Power Status with acpi

A Step-by-Step Introduction

A hands-on exercise to inspect specific power-related hardware, including the AC adapter, battery, and thermal zones, using the targeted flags of the acpi command-line tool.
Author

Chuck Nelson

Published

November 16, 2025

1 Purpose

This exercise demonstrates how an operating system can query the underlying hardware for critical status information. You will use the acpi command-line tool to inspect specific information about the power and thermal status of the host machine. Instead of viewing all information at once, we will take a step-by-step approach to look at each component that ACPI can report on, providing a clearer understanding of the tool’s capabilities.

2 What You’ll Accomplish

By the end of this exercise, you will be able to:

  • Install the acpi utility on Fedora.
  • Use specific acpi flags to view AC adapter, battery, and thermal information individually.
  • Identify other Linux utilities and methods for retrieving power status information.

This exercise maps to the following program and course learning outcomes:

  • Course Learning Outcomes (CLOs):
    • 3. Troubleshoot hardware and basic network components: Checking power and thermal status is a fundamental step in troubleshooting performance and stability issues on mobile devices.

This exercise develops the following skills, which align with the O*NET SOC Code 15-1232.00 for Computer User Support Specialists.

Learning Objective O*NET KSAs Technologies Used
Inspect specific power subsystems using acpi. Knowledge: Computers & Electronics
Skills: Troubleshooting, Systems Analysis
acpi

3 Prerequisites

This exercise requires a running Fedora 42 virtual machine with internet access and a user account with sudo privileges. For best results, this exercise should be performed on a laptop computer that has a battery.

4 Step-by-Step Guide

Open a terminal window in your Fedora VM to begin.

4.1 Step 1: Install the acpi Tool

The acpi command is a simple tool for reading information from the ACPI (Advanced Configuration and Power Interface) system. It may not be installed by default.

  1. Install it now using dnf:

    sudo dnf install -y acpi

4.2 Step 2: Check AC Adapter Status

Let’s start by checking if the system is running on AC power.

  1. Run the acpi command with the -a (or --ac-adapter) flag:

    acpi -a
  2. Analyze the Output: The result will be either on-line or off-line. This tells you if the AC adapter is currently powering the machine.

4.3 Step 3: Check Battery Status

Next, let’s get the status of the battery.

  1. Run the acpi command with the -b (or --battery) flag: and the -i (or --details) flag

    acpi -bi
  2. Analyze the Output: This will show you the battery’s state (Charging, Discharging, or Full), its current charge percentage, and an estimated time until full or empty.

4.4 Step 4: Check Thermal Status

ACPI also provides access to the system’s thermal zones, typically the CPU temperature.

  1. Run the acpi command with the -t (or --thermal) flag:

    acpi -t
  2. Analyze the Output: This will show you the temperature of one or more thermal zones in degrees Celsius.

4.5 Step 5: Get a Combined View

Finally, the -V flag you used previously is simply a shortcut to show all of this information at once.

  1. Run the verbose command to see everything together: sh acpi -V

5 Beyond acpi: Other Power Utilities

While acpi is simple and direct, Fedora includes more powerful and modern tools for power management.

  • upower: This is the standard command-line tool for interacting with the system’s main power management service. It provides much more detail than acpi, including battery health, energy capacity, and historical data. You will explore this tool in a later exercise.
  • The /sys Filesystem: At the lowest level, all information about your hardware is exposed by the Linux kernel as files in the /sys directory. You can read this information directly.

You can get the raw battery percentage by reading a file directly. First, find your battery’s name (usually BAT0 or BAT1):

ls /sys/class/power_supply/

Then, use cat to read the capacity file for that battery. This file contains a single number representing the percentage.

# Replace BAT0 if your battery has a different name
cat /sys/class/power_supply/BAT0/capacity

This demonstrates the core Linux philosophy that “everything is a file.”

6 Reflect and Review

ImportantReflection: 3-2-1

Now that you have completed this exercise, reflect on your experience in your Microsoft Teams Student Notebook:

  • 3 different acpi flags you used and what they show.
  • 2 other ways to get power information in Linux besides acpi.
  • 1 question you still have about the ACPI interface.
TipCheck on Learning

Answer these questions in your notebook to solidify your understanding:

  1. What acpi command would you use to check only the CPU temperature?
  2. You run acpi -a and the output is off-line. What does this mean?
  3. What is one piece of information that upower can provide that acpi does not?
  4. Why is it useful to look at power information in separate, targeted steps rather than all at once?
Back to top