You can use any one of the following commands to get battery status, remaining battery life and more:
- apm command : The apm utility controls the Intel / Microsoft APM (Advanced Power Management) BIOS and displays the current status of APM on laptop PCs.
- sysctl command : The sysctl utility retrieves kernel state.
- hwstat command : Another command line tool to display CPU temp and battery info.
- acpiconf command : The acpiconf command allows the user control of the ACPI power management functions and query laptop battery status.
amp command example
The syntax is:
apm apm [options]
Type the following command:
$ apm
Sample outputs:
sysctl command example
Type the following command:
$ sysctl hw.acpi.battery
Sample outputs:
hw.acpi.battery.life: 100 hw.acpi.battery.time: -1 hw.acpi.battery.state: 0 hw.acpi.battery.units: 1 hw.acpi.battery.info_expire: 5
hwstat command
The hwstat command is not part of the base system. Type the following command to install hwstat using pkg_add command:
# pkg_add -rv hwstat
Sample outputs:
scheme: [ftp] user: [] password: [] host: [ftp.freebsd.org] port: [0] document: [/pub/FreeBSD/ports/amd64/packages-9.0-release/Latest/hwstat.tbz] ---> ftp.freebsd.org:21 looking up ftp.freebsd.org connecting to ftp.freebsd.org:21 <<< 220 beastie.tdk.net FTP server (Version 6.00LS) ready. >>> USER anonymous <<< 331 Guest login ok, send your email address as password. >>> PASS vivek@fdbsd9 <<< 230 Guest login ok, access restrictions apply. >>> PWD <<< 257 "/" is current directory. >>> CWD pub/FreeBSD/ports/amd64/packages-9.0-release/Latest <<< 250 CWD command successful. >>> MODE S <<< 200 MODE S accepted. >>> TYPE I <<< 200 Type set to I. setting passive mode >>> PASV <<< 227 Entering Passive Mode (193,162,146,4,226,183) opening data connection initiating transfer >>> RETR hwstat.tbz <<< 150 Opening BINARY mode data connection for 'hwstat.tbz' (8779 bytes). Fetching ftp://ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-9.0-release/Latest/hwstat.tbz...Waiting for final status <<< 226 Transfer complete. x +CONTENTS x +COMMENT x +DESC x +MTREE_DIRS x bin/hwstat x share/licenses/hwstat-0.5.1/catalog.mk x share/licenses/hwstat-0.5.1/LICENSE x share/licenses/hwstat-0.5.1/BSD x man/man1/hwstat.1.gz tar command returns 0 status Done. extract: Package name is hwstat-0.5.1 extract: CWD to /usr/local extract: /usr/local/bin/hwstat extract: /usr/local/share/licenses/hwstat-0.5.1/catalog.mk extract: /usr/local/share/licenses/hwstat-0.5.1/LICENSE extract: /usr/local/share/licenses/hwstat-0.5.1/BSD extract: /usr/local/man/man1/hwstat.1.gz extract: CWD to /usr/local Running mtree for hwstat-0.5.1.. mtree -U -f +MTREE_DIRS -d -e -p /usr/local >/dev/null Attempting to record package into /var/db/pkg/hwstat-0.5.1.. Package hwstat-0.5.1 registered in /var/db/pkg/hwstat-0.5.1
Type the following command to see CPU temperature and battery information under FreeBSD operating system:
$ hwstat
Sample outputs:
acpiconf command example
To see information about the specified battery, enter:
$ acpiconf -i batt#
$ acpiconf -i 0 | grep capacity
$ acpiconf -i 0
Sample outputs:
Design capacity: 50000 mWh Last full capacity: 50000 mWh Technology: secondary (rechargeable) Design voltage: 10000 mV Capacity (warn): 100 mWh Capacity (low): 50 mWh Low/warn granularity: 1 mWh Warn/full granularity: 1 mWh Model number: 1 Serial number: 0 Type: VBOX OEM info: innotek State: high Remaining capacity: 100% Remaining time: unknown Present rate: 0 mW Present voltage: 10000 mV
You should follow me on twitter here or grab rss feed to keep track of new changes.
Featured Articles:
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012

- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop
















{ 0 comments… add one now }