How to get the battery status from command line?

We can echo battery percentage with the following command:

upower -i $(upower -e | grep 'BAT') | grep -E "state|to\ full|percentage" | awk '/perc/{print $2}'
# 65%

Other details and methods about battery status are available on this QA

Share this post on:

Related posts:

How to detach a process from terminal's shell?
Using a different network interface for a specific application