Results 1 to 8 of 8

Thread: battery level terminal

  1. #1
    Join Date
    Aug 2009
    Location
    Australia
    Beans
    73
    Distro
    Ubuntu 9.10 Karmic Koala

    battery level terminal

    Want to check laptop battery level status from terminal. I have seen a suggestion of installing acpi.
    Is there a way to check the battery level without extra programs (eg programs alreayd installed onto the machine)?

  2. #2
    Join Date
    Oct 2006
    Location
    Tucson, AZ
    Beans
    1,420
    Distro
    Xubuntu 10.04 Lucid Lynx

    Re: battery level terminal

    Quote Originally Posted by Esthellin View Post
    Want to check laptop battery level status from terminal. I have seen a suggestion of installing acpi.
    Is there a way to check the battery level without extra programs (eg programs alreayd installed onto the machine)?
    The "acpi" program is installed as part of the package "acpi", which I think is part of a standard install (type "which acpi" in a terminal window to see if "/usr/bin/acpi" is there).

    Other than that, you can look at the file(s) in "/proc/acpi/battery", but without a utility program to translate the info that might be hard to understand.

    Lloyd B.
    Don't tell me to get a life.
    I had one once.
    It sucked.

  3. #3
    Join Date
    Dec 2007
    Location
    BUE @ Argentina
    Beans
    1,225
    Distro
    Kubuntu 9.04 Jaunty Jackalope

    Re: battery level terminal

    Code:
    $ sudo acpitools
    Good luck!
    /**HP Pavilion DV6646us laptop: AMD 1.9 GHz Turion 64 X2 / 2Gb RAM / 160Gb HDD / NVIDIA GeForce Go 7150M / 15.4" WXGA / BroadCom BCM4328 wireless / Built-in webcam **/
    -- Kubuntu 9.04, CentOs 5.2, Mikrotik RouterOS 3.3 User -- Argentina LoCo Team

  4. #4
    Join Date
    Mar 2005
    Location
    Texas
    Beans
    1,675
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: battery level terminal

    Code:
    cat /proc/acpi/battery/BAT0/state
    100 buckets of bits on the bus,
    100 buckets of bits,
    Take one down, short it to ground,
    FF buckets of bits on the bus.

  5. #5
    Join Date
    Aug 2009
    Location
    Australia
    Beans
    73
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: battery level terminal

    Quote Originally Posted by Whiffle View Post
    Code:
    cat /proc/acpi/battery/BAT0/state
    I just tried this one. It shows the state but not in a human-readable format (eg its in mW and mWh instead of in hours or percentage). Any simple way of converting this?

    Funny thing is, I ran file /proc/acpi/battery/BAT0/state, and the file was empty, yet 'cat'ting it gave input. Freaky phantom file contents ;D.

    As said in the first post, I don't have/want acpi installed onto the laptop (trying to cut down on file system usage).
    I found that apm was originally the program used instead of acpi, and saw that this was installed. But running "apm" in terminal gives "No APM support in kernel", which is throghouly unhelpful.
    No searches so far have helped 'adding' support for apm.
    The program acpitool was also not installed.

  6. #6
    Join Date
    Mar 2005
    Location
    Texas
    Beans
    1,675
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: battery level terminal

    I think if you take the "remaining capacity" in mAh, divided by the "design capacity" in cat /proc/acpi/battery/BAT0/info, you'll get a percentage.
    100 buckets of bits on the bus,
    100 buckets of bits,
    Take one down, short it to ground,
    FF buckets of bits on the bus.

  7. #7
    Join Date
    Aug 2009
    Location
    Australia
    Beans
    73
    Distro
    Ubuntu 9.10 Karmic Koala

    Re: battery level terminal

    That gives a percentage of 75% when it should be 100%.
    I disconnected the powercord and then:
    09:03{~} cat /proc/acpi/battery/BAT1/state
    present: yes
    capacity state: ok
    charging state: discharging
    present rate: 22509 mW
    remaining capacity: 39349 mWh
    present voltage: 11340 mV

    I did (remaining capacity)/(present rate). that gave me the time remaining in the battery. Still can't get a percentage though.

  8. #8
    Join Date
    Jul 2011
    Beans
    1

    Re: battery level terminal

    Code:
    upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage|time"
    you can try this command in terminal to get deatails of battery

    or may try this to view more details about your battery

    Code:
    upower -i /org/freedesktop/UPower/devices/battery_BAT0
    http://sudevshares.blogspot.com/

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •