LinuxCommandLibrary

battop

Monitor battery status and power consumption

TLDR

Display battery information

$ battop
copy

Change battery information measurement [u]nit (default: human)
$ battop -u [human|si]
copy

SYNOPSIS

battop [OPTIONS]

PARAMETERS

-d <delay>, --delay <delay>
    Specify the delay in seconds between screen updates. The default update interval is 1 second.

-n <count>, --count <count>
    Exit battop after the specified number of updates have occurred.

-b <power_supply_id>, --battery <power_supply_id>
    Monitor a specific battery by its ID (e.g., BAT0, BAT1). If this option is not specified, battop will display information for all detected batteries.

-v, --version
    Display the version information of battop and then exit.

-h, --help
    Display a concise help message detailing command usage and available options, then exit.

DESCRIPTION

battop is a command-line utility for monitoring battery status in real-time on Linux systems. It provides an interactive interface, conceptually similar to top or htop, but specifically designed to display comprehensive battery information. This includes current charge percentage, full capacity, charge/discharge rates, voltage, temperature (if available), health status, and estimated time remaining.

The tool aggregates data from the /sys/class/power_supply subsystem, offering a dynamic and easy-to-read view of all detected power supply devices. battop is particularly useful for laptop and mobile device users, allowing them to quickly assess battery health, monitor power consumption, and understand charging/discharging behavior without needing to manually parse raw system files. It can aid in diagnosing power-related issues or simply keeping an eye on battery performance during mobile operation. Its intuitive design makes it a valuable addition to a system administrator's or power user's toolkit.

CAVEATS

battop is a Linux-specific utility as it relies directly on the /sys/class/power_supply filesystem for battery data. It may not work correctly or display complete information on all hardware configurations, especially if ACPI or power supply drivers are not standard or fully supported by the kernel. For typical usage, it requires appropriate permissions to read power supply information, which is generally accessible to normal users. It is primarily intended for devices with exposed battery information, such as laptops; desktop systems without a UPS or integrated battery might not show any relevant data.

INTERACTIVE KEYS

When battop is running in its interactive display mode, users can press 'q' to immediately quit the application. Additionally, pressing 'r' will force an immediate refresh of the displayed battery data, overriding the configured update delay.

UNDERLYING DATA SOURCE

The information presented by battop is directly sourced from the Linux kernel's power supply subsystem. This subsystem exposes various power-related details through a structured hierarchy of files within the /sys/class/power_supply directory. Each power supply device (e.g., a specific battery like BAT0, or an AC adapter identified as AC) has its own subdirectory containing files like capacity, energy_now, voltage_now, status, and charge_now. battop reads and interprets these files to present its real-time data to the user.

HISTORY

battop is a relatively modern command-line utility, often implemented using memory-safe languages like Rust to provide a robust and efficient real-time experience. Its development likely emerged in response to the growing need for a more user-friendly, interactive battery monitoring tool, offering a visual alternative to manually parsing raw system files or using less dynamic commands like acpi. It aims to provide a top-like interface for battery status, making it easier for users to track power statistics. While its exact initial release date can vary depending on specific open-source projects with similar names or goals, the general concept of a `top`-style battery monitor gained traction in the late 2010s within the Linux community.

SEE ALSO

acpi(1), upower(1), top(1), htop(1), tlp(8)

Copied to clipboard