How to check battery status in ubuntu using command terminal
On linux, we can find out information and status of the battery through the terminal. Here's a very short tutorial on how to see the status of the battery through terminal with upower command, and a tips to make it lot easier.Upower is an abstraction for enumerating devices, power devices, activity monitor and update the query history and statistics. Created by freedesktop.org. Information and complete documentation can be visited at http://upower.freedesktop.org/.
To view battery information, the first is to search path for device battery with the command:
upower -e
Then some device path will show up like example below:
/org/freedesktop/UPower/devices/line_power_ADP0 /org/freedesktop/UPower/devices/battery_BAT0 /org/freedesktop/UPower/devices/DisplayDevice
If it the device path list does not appear like above, but instead the error message "command not found" that means upower is not installed (Which is very rare occasion in linux OS). Please install first upower with command:
sudo apt-get install upower
for ubuntu, debian, mint and it's kind.
Each of 3 paths above pointing to the power devices, such as, in the above example is the line power (AC adapter), battery, and display device.
After we figure out the path for the battery, in the case above, it's /org/freedesktop/UPower/devices/battery_BAT0, then we can check the battery status with the command:
upower -i /org/freedesktop/UPower/devices/battery_BAT0
It will output some information like below:
native-path: BAT0 vendor: <a class="zem_slink" title="Laptop" href="http://en.wikipedia.org/wiki/Laptop" target="_blank" rel="wikipedia">NOTEBOOK</a> model: BAT serial: 0001 power supply: yes updated: Sat 29 Aug 2015 10:51:07 PM WIB (107 seconds ago) has history: yes has statistics: yes battery present: yes rechargeable: yes state: discharging warning-level: none <a class="zem_slink" title="Energy" href="http://en.wikipedia.org/wiki/Energy" target="_blank" rel="wikipedia">energy</a>: 19.9911 Wh energy-empty: 0 Wh energy-full: 31.3797 Wh energy-full-design: 48.84 Wh energy-rate: 12.9156 W voltage: 14.8 V time to empty: 1.5 hours percentage: 63% capacity: 64.25% technology: <a class="zem_slink" title="Lithium-ion battery" href="http://en.wikipedia.org/wiki/Lithium-ion_battery" target="_blank" rel="wikipedia">lithium-ion</a> icon-name: 'battery-full-symbolic' History (charge): 1440863467 63.000 discharging History (rate): 1440863467 12.916 discharging
From the information above, we know that my laptop isn't connected to a charger / power source (state = discharging). Battery energy (energy) 19.9911 Wh or 63%.in percentage.
Full battery (energy-full) 31.3797 Wh. Which means my battery life have been degraded, and could only be charged until it reach 31.3797 Wh, which is, by design, supposed to be (energy-full-design) 48.84 Wh. Its max capacities (capacity) has been reduced from the original 64.25% (new).
You may experiment and observe other information.
How to make a shortcut to check laptop batteries in terminal
Now to make it even easier, we can create a command alias/shortcut for the above commands.
It's as simple as editiing the .bashrc file. in your home directory:
nano ~/.bashrc
If the file does not exist (empty), try to replace it with the file. bash_profile or. profile.
And then on top of the lines, add the line:
alias battery='upower -i /org/freedesktop/UPower/devices/battery_BAT0'
change 'battery' onto whatever word you like without any spaces.
Save and execute:
source ~/.bashrc
to reload your .bashrc or .bash_profile flle.
Then try your newly defined alias.
Subscribe to:
Post Comments
(
Atom
)
Amazing Article, Really useful information to all So, I hope you will share more information to be check and share here.
ReplyDeleteJupyter Notebook
Jupyter Notebook Online
Jupyter Notebook Install
Automation Anywhere Tutorial
Rpa automation anywhere tutorial pdf
Automation anywhere Tutorial for beginners
Kivy Python
Kivy Tutorial
Kivy for Python
Kivy Installation on Windows