20230112在Ubuntu下看笔记本电脑电池的电量

20230112在Ubuntu下看笔记本电脑电池的电量
2023/1/12 17:24

ubuntu20.04

Xshell 7 (Build 0108)
Copyright (c) 2020 NetSarang Computer, Inc. All rights reserved.

Type `help' to learn how to use Xshell prompt.
[C:\~]$ 

Connecting to 192.168.186.228:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Welcome to Ubuntu 20.04.3 LTS (GNU/Linux 5.8.0-48-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

415 updates can be applied immediately.
311 of these updates are standard security updates.
To see these additional updates run: apt list --upgradable


The list of available updates is more than a week old.
To check for new updates run: sudo apt update
New release '22.04.1 LTS' available.
Run 'do-release-upgrade' to upgrade to it.

Your Hardware Enablement Stack (HWE) is supported until April 2025.
Last login: Thu Jan 12 17:19:28 2023 from 192.168.186.224
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ 
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ upower --dump | grep --color=never -E "state|to\ full|to\ empty|percentage"
    state:               discharging
    time to empty:       38.0 minutes
    percentage:          21%
    state:               discharging
    time to empty:       38.0 minutes
    percentage:          21%
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ 
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ upower -i /org/freedestkop/UPower/devices/battery_BAT0 | grep -i "state\|percentage\|time to empty"
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ 
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ upower -i /org/freedestkop/UPower/devices/battery_BAT0
  native-path:          (null)
  power supply:         no
  updated:              1970年01月01日 星期四 08时00分00秒 (1673515235 seconds ago)
  has history:          no
  has statistics:       no
  unknown
    warning-level:       unknown
    battery-level:       unknown
    icon-name:          '(null)'

rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ 
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ upower --dump | grep --color=never -E "state|to\ full|to\ empty|percentage"
    state:               discharging
    time to empty:       35.5 minutes
    percentage:          20%
    state:               discharging
    time to empty:       35.5 minutes
    percentage:          20%
rootroot@rootroot-HP-ZHAN-66-Pro-A-14-G3:~$ 
 

 

ubuntu22.04

Xshell 7 (Build 0108)
Copyright (c) 2020 NetSarang Computer, Inc. All rights reserved.

Type `help' to learn how to use Xshell prompt.
[C:\~]$ 

Connecting to 192.168.186.227:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'.

Welcome to Ubuntu 22.04.1 LTS (GNU/Linux 5.15.0-57-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/advantage

131 updates can be applied immediately.
To see these additional updates run: apt list --upgradable

Last login: Thu Jan 12 14:09:23 2023 from 192.168.186.224
rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ 
rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ 
rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ sudo apt-get install acpi
[sudo] password for rootroot: 
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  acpi
0 upgraded, 1 newly installed, 0 to remove and 160 not upgraded.
Need to get 13.0 kB of archives.
After this operation, 53.2 kB of additional disk space will be used.
Get:1 http://cn.archive.ubuntu.com/ubuntu jammy/universe amd64 acpi amd64 1.7-1.1ubuntu1 [13.0 kB]
Fetched 13.0 kB in 1s (20.7 kB/s)
Selecting previously unselected package acpi.
(Reading database ... 223284 files and directories currently installed.)
Preparing to unpack .../acpi_1.7-1.1ubuntu1_amd64.deb ...
Unpacking acpi (1.7-1.1ubuntu1) ...
Setting up acpi (1.7-1.1ubuntu1) ...
Processing triggers for man-db (2.10.2-1) ...
rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ acpi -i
Battery 0: Not charging, 100%
Battery 0: design capacity 3549 mAh, last full capacity 3231 mAh = 91%
rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ 
rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ 
rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ acpi -i
Battery 0: Not charging, 100%
Battery 0: design capacity 3549 mAh, last full capacity 3231 mAh = 91%
rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ 
rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ upower -i /org/freedestkop/UPower/devices/battery_BAT0 | grep -i "state\|percentage\|time to empty"
    percentage:          0% (should be ignored)
rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ 
rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ upower -i /org/freedestkop/UPower/devices/battery_BAT0 
  native-path:          (null)
  power supply:         no
  updated:              1970年01月01日 星期四 08时00分00秒 (1673514445 seconds ago)
  has history:          no
  has statistics:       no
  unknown
    warning-level:       unknown
    battery-level:       unknown
    percentage:          0% (should be ignored)
    icon-name:          '(null)'

rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ 
rootroot@rootroot-adol-ADOLBOOK-I421UAY-ADOL14UA:~$ 
 

 


参考资料:
https://blog.51cto.com/u_13733787/5767749
ubuntu linux终端下查看电池状态


https://developer.aliyun.com/article/1040701
查看ubuntu 下 电池电量的2种方法
 

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值