Wednesday, March 2, 2011

how to check battery status in ubuntu using command line.

if you use ubuntu in text mode or with fluxbox, the battery status is not shown, so to see how much hour the battery is left you can use command "acpi".

you just type acpi it will show you the information, example:

root@dara-K42JB:/home/dara# acpi
     Battery 0: Discharging, 100%, 00:1:34 remaining

-- my battery is fully charged (100%) and and it will last in 1 hour 34 minute later.

acpi has many other other you can type "acpi -h" to find out, you can get the temperature of thermal, etc....

this is the output of acpi -h
root@dara-K42JB:/home/dara# acpi -h
Usage: acpi [OPTION]...
Shows information from the /proc filesystem, such as battery status or
thermal information.

  -b, --battery            battery information
  -B, --without-battery        suppress battery information
  -a, --ac-adapter            ac adapter information
  -A, --without-ac-adapter         suppress ac-adapter information
  -t, --thermal            thermal information
  -T, --without-thermal        suppress thermal information
  -c, --cooling            cooling information
  -C, --without-cooling        suppress cooling information
  -V, --everything            show every device, overrides above options
  -s, --show-empty            show non-operational devices
  -S, --hide-empty            hide non-operational devices
  -f, --fahrenheit            use fahrenheit as the temperature unit
  -k, --kelvin            use kelvin as the temperature unit
  -d, --directory <dir>        path to ACPI info (/sys/class resp. /proc/acpi)
  -p, --proc                use old proc interface instead of new sys interface
  -h, --help                display this help and exit
  -v, --version            output version information and exit

By default, acpi displays information on installed system batteries.
Non-operational devices, for example empty battery slots are hidden.
The default unit of temperature is degrees celsius.

Report bugs to Michael Meskes <>.

No comments:

Post a Comment