How to Check a Linux Laptop’s Battery From the Command Line

Configurare noua (How To)

Situatie

Solutie

The upower command can be used to find out what mains power and battery sources are available to your laptop. Once you’ve discovered them you can ask for more details.

The -e (enumerate) option lists all of the power sources it can find.

upower -e

The first entry is for the AC adapter. The second is the battery. You may find you have several batteries in your laptop. Also, note that the first battery is sometimes numbered one, and sometimes it is numbered as zero, according to the preferences of the manufacturer.

The “DisplayDevice” entry isn’t a power source. It is a composite device that represents the status icon to show in desktop environments.

To take a closer look at our battery, we’ll use the -i (information) option, and pass the full descriptor for the battery: upower -i /org/freedesktop/UPower/devices/battery_BAT1

The two items of most interest are the “Time to Empty” value and the “Percentage” value. These give an indication of the duration that the battery can continue to power the laptop, and the percentage of charge remaining in the battery.

Tip solutie

Permanent

Voteaza

(7 din 17 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?