Skip to content
Code and Bytes Code and Bytes

Code and Bytes
Code and Bytes

Comando para chequear el estado de la bateria desde la terminal

Posted on 7 August, 201412 March, 2021

Para ver las estadísticas de la batería lo podemos saber con el siguiente comando:

upower -i /org/freedesktop/UPower/devices/battery_BAT0

El cual muestra esta salida

jaime@osmonPC:~$ upower -i /org/freedesktop/UPower/devices/battery_BAT0
native-path: /sys/devices/LNXSYSTM:00/LNXSYBUS:00/PNP0C0A:00/power_supply/BAT0
vendor: HP
power supply: yes
updated: Thu 07 Aug 2014 07:34:42 AM COT (28 seconds ago)
has history: yes
has statistics: yes
battery
present: yes
rechargeable: yes
state: discharging
energy: 9.6336 Wh
energy-empty: 0 Wh
energy-full: 40.4244 Wh
energy-full-design: 40.4244 Wh
energy-rate: 14.2884 W
voltage: 10.325 V
time to empty: 40.5 minutes
percentage: 23.8312%
capacity: 100%
technology: lithium-ion
History (rate):
1407414882 14.288 discharging
1407414852 14.051 discharging
1407414822 14.072 discharging

Con el comando grep podemos sacar la información que consideremos mas valiosa, añadiendo al final  grep -E “state|to\ full|percentage” quedando el comando así:

upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep -E "state|to\ full|percentage"

Mostrando este resultado:

 state: charging
 time to full: 3.2 hours
 percentage: 21.8274%

Se puede crear un alias si se va a usar con mayor frecuencia, añadiendo el comando al final del archivo .bashrc ubicado en el home.

sudo nano /home/jaime/.bashrc
 alias bat='upower -i /org/freedesktop/UPower/devices/battery_BAT0| grep -E "state|to\ full|percentage"'

Se llama con el comando bat

Linux baterialinuxterminal

Post navigation

Previous post
Next post

Related Posts

Linux

Instalar servidor FTP (vsftpd)

Posted on 16 June, 201423 December, 2014

Instalamos vsftpd sudo apt-get install vsftpd Entramos al archivo de configuración: nano /etc/vsftpd.conf Por seguridad se deshabilita el acceso anónimo

Read More
Asterisk ssh

Conectar openvox por ssh

Posted on 7 April, 202018 April, 2020

ssh -p12345 admin@192.168.1.201 Por defecto el puerto de ssh es el 12345 y el usuario admin, pero al realizar la conexión aparece el siguiente error: Unable to negotiate with 192.168.1.201 port 12345: no matching key exchange method found. Their offer: diffie-hellman-group1-sha1

Read More
Linux

Habilitar query log en MySQL

Posted on 24 October, 20199 April, 2020

Editar el archivo /etc/mysql/my.cnf y agregar al final del archivo: [mysqld] general_log=on general_log_file=/var/log/mysql/query.log Reiniciar el servicio service mysql restart Revisamos la salida tail -f /var/log/mysql/query.log

Read More

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Buscar

Categorias

  • AI (2)
  • Asterisk (9)
  • Bases de datos (1)
  • DevOps (4)
  • Git (2)
  • HTML (1)
  • Laravel (6)
  • Linux (67)
  • MCP Server (1)
  • Mikrotik (3)
  • MySQL (5)
  • n8n (1)
  • Personal (4)
  • PHP (15)
  • Python (2)
  • Software recomendado (1)
  • Tips (1)
  • VSCode (4)
  • vTiger (4)
  • Windows (10)
  • Wordpress (4)
©2026 Code and Bytes | WordPress Theme by SuperbThemes