Getting information about the battery status on Kali Linux with the command line is very easy.
Firstly, install the acpi utility.
┌──(john㉿kali)-[~] └─$ acpi Command 'acpi' not found, but can be installed with: sudo apt install acpi Do you want to install it? (N/y)y sudo apt install acpi [sudo] password for john: Reading package lists... Done Building dependency tree... Done Reading state information... Done The following packages were automatically installed and are no longer required: libadwaita-1-0 libaio1 libappstream5 libatk-adaptor libboost-dev libboost1.83-dev libopenblas-dev libopenblas-pthread-dev libopenblas0 libpython3-all-dev libpython3.12 libpython3.12-dev libstemmer0d libxmlb2 libxsimd-dev python3-all-dev python3-anyjson python3-beniget python3-gast python3-pyatspi python3-pypdf2 python3-pyppeteer python3-pyrsistent python3-pythran python3.12-dev xtl-dev zenity zenity-common Use 'sudo apt autoremove' to remove them. The following NEW packages will be installed: acpi 0 upgraded, 1 newly installed, 0 to remove and 0 not upgraded. Need to get 13.9 kB of archives. After this operation, 48.1 kB of additional disk space will be used. Get:1 http://kali.download/kali kali-rolling/main amd64 acpi amd64 1.7-1.3 [13.9 kB] Fetched 13.9 kB in 2s (6020 B/s) Selecting previously unselected package acpi. (Reading database ... 450580 files and directories currently installed.) Preparing to unpack .../acpi_1.7-1.3_amd64.deb ... Unpacking acpi (1.7-1.3) ... Setting up acpi (1.7-1.3) ... Processing triggers for kali-menu (2023.4.7) ... Processing triggers for man-db (2.12.0-3) ... |
Then, run it like this to print information about the battery charge.
┌──(john㉿kali)-[~] └─$ acpi Battery 0: Discharging, 95%, 05:31:05 remaining |
This is very simple.
Another way is to use the Upower command. This returns comprehensive battery information.
┌──(john㉿kali)-[~] └─$ upower -i /org/freedesktop/UPower/devices/battery_BAT0 native-path: BAT0 vendor: SMP model: bq20z451 power supply: yes updated: Thu Apr 25 17:07:26 2024 (4 seconds ago) has history: yes has statistics: yes battery present: yes rechargeable: yes state: discharging warning-level: none energy: 45.5772 Wh energy-empty: 0 Wh energy-full: 50.5552 Wh energy-full-design: 54.34 Wh energy-rate: 10.754 W voltage: 8.186 V charge-cycles: 67 time to empty: 4.2 hours percentage: 90.1533% temperature: 27.3 degrees C capacity: 93.035% technology: lithium-ion icon-name: 'battery-full-symbolic' History (charge): 1714028846 90.153 discharging 1714028816 90.695 discharging 1714028786 91.115 discharging 1714028756 91.040 discharging History (rate): 1714028846 10.754 discharging 1714028816 10.982 discharging 1714028786 20.657 discharging 1714028756 8.991 discharging |
This is very useful when using a laptop running Linux and you wish to check the battery status quickly.
And finally another example, this just prints the battery level.
┌──(john㉿kali)-[~] └─$ awk '{print $1}' /sys/class/power_supply/BAT0/capacity |