1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

macOS バッテリー残量(%)をコマンドで取得する

Posted at


MacbookPro 2019 のバッテリーを交換した。バッテリー駆動時の残容量をモニターするため、コマンドでバッテリー残量を取得する必要があった。

・ 次のコマンドで取得可能

$ pmset -g batt | grep -Eo "\d+%"
99%

・ 数値だけ欲しい場合

$ pmset -g batt | grep -Eo "\d+%" | cut -d% -f1
99





・ 他にも 様々なバッテリー情報が コマンドで取得できる

@ktdatascienceさんの記事を参照。



以上

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?