Linux Laptop Display Battery Status And Thermal Temperature From Command Line

www.‮tual‬turi.com
Linux Laptop Display Battery Status And Thermal Temperature From Command Line

There are a few different ways you can display battery status and thermal temperature information from the command line on a Linux laptop:

  1. acpi command: The acpi command is a command-line utility that can be used to display battery and thermal information on many Linux systems. To display battery status, use the -b flag:
acpi -b

To display thermal information, use the -t flag:

acpi -t
  1. upower command: The upower command is a command-line utility that can be used to display battery and power management information on many Linux systems. To display battery status, use the -i flag followed by the battery device:
upower -i /org/freedesktop/UPower/devices/battery_BAT0

To display thermal information, use the sensors command:

sensors
  1. /sys filesystem: The /sys filesystem contains a virtual file system that provides access to information about the hardware and kernel of a Linux system. To display battery status, you can read the files in the /sys/class/power_supply/<battery> directory, where <battery> is the name of the battery device (e.g. BAT0). For example, to display the remaining capacity of the battery, you can use the following command:
cat /sys/class/power_supply/BAT0/capacity

To display thermal information, you can read the files in the /sys/class/thermal directory. For example, to display the temperature of the thermal zone 0, you can use the following command:

cat /sys/class/thermal/thermal_zone0/temp

Note: The availability and exact location of the battery and thermal information in the /sys filesystem may vary depending on the hardware and kernel of your Linux system.

Created Time:2017-10-30 10:17:34  Author:lautturi