DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Check Battery Status from Terminal in Linux


  1. List device name of the battery: upower -e, I got the name is "/org/freedesktop/UPower/devices/battery_BAT0";

  2. Print the status of the battery: upower -i /org/freedesktop/UPower/devices/battery_BAT0;

  3. Only print the charge persent of the battery: upower -i /org/freedesktop/UPower/devices/battery_BAT0|awk '/^\s*percentage:/ {print $2}'



Published

Jun 4, 2014

Last Updated

Jun 4, 2014

Category

Tech

Tags

  • battery 1
  • linux 158

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor