I've been asked to estimate the power consumption of the servers I run for my laboratory. I thought that I'd ask if there was some handy Linux commandline to get the power consumption of the server. It looks like powertop is useful for minimizing power consumption but it does not seem to show information that server A is using B watts.

Is there something buried in the /proc system that would help me out?

  • Do you mean powertop shows no ACPI power usage estimate available? – Mikel Apr 1 '11 at 3:00
  • It may be worth mentioning that there are instruments available for measuring current/voltage. A current clamp around a power cord can measure current, then multiplied by the mains voltage (120V?). For an estimate, you could even turn the system on and see how much the power meter speeds up. – mbowden May 10 '18 at 14:07

If your computer actually keeps track of power (e.g. notebook), than on kernel 3.8.11 you can use the command below. It returns power measured in microwatts.

cat /sys/class/power_supply/BAT0/power_now

This works on kernel 3.8.11 (Ubuntu Quantal mainline generic).

  • 8
    It actual is in µW and can be printed like this in terms of watts: awk '{print $1*10^-6 " W"}' /sys/class/power_supply/BAT0/power_now – Matt Jul 27 '16 at 0:34
  • @Matt Yes, you are right. Answer corrected. Thank you. – Adam Ryczkowski Jul 27 '16 at 15:02
  • 2
    If your system does not have the file power_now in /sys/class/power_supply/BAT0/, you can multiply the values in the files current_now and voltage_now from that directory to get power_now (don't forget to convert units accordingly, both files use µ units). – Tomáš Peitl May 12 '18 at 17:50
  • 1
    On my ThinkPad this command shows the power draw only while charging/discharging. From the moment battery is fully charged, it always shows 0. – anatolii Sep 2 '19 at 20:52
  • 2
    My /sys/class/power_supply directory @ ArchLinux Dell workstation is empty. Are there any other alternatives? – mabalenk Jun 18 '20 at 13:51

Another KISS solution completing Adam's sugestion. This is for people who dont have a power_now file. (Arch)

echo - | awk "{printf \"%.1f\", \
$(( \
  $(cat /sys/class/power_supply/BAT1/current_now) * \
  $(cat /sys/class/power_supply/BAT1/voltage_now) \
)) / 1000000000000 }" ; echo " W "

Reports the actual power draw in Watts with one decimal place.

  • 4
    only works if it has a battery. – KFL Aug 27 '18 at 7:07
  • When plugged in reports 0.0 W when unplugged reports 44.3 W. Works for me. – WinEunuuchs2Unix Oct 25 '18 at 23:11
  • 2
    If you get syntax error: operand expected (error token is "* "), then it's possible the path in the cat command is non-existent. For me on Ubuntu 16.04, changing the 2 instance of BAT1 to BAT* fixed that. – Garrett Nov 12 '18 at 21:54
  • Another version of the same command, handling the charging situation: path="/sys/class/power_supply/BAT0"; value=$(echo "scale=1; $(cat ${path}/current_now) * $(cat ${path}/voltage_now) / 10^12" | bc); [[ $value == "0" ]] && echo "" || echo "${value}W" I used this for showing power consumption on panel in Linux Mint/Cinnamon, using the Bash Sensors applet. It shows either the wattage or nothing. – rlat Feb 25 '20 at 16:46
  • #~/bin/bash echo - | awk "{printf \"%.1f\", \ $(( \ $(cat /sys/class/power_supply/BAT0/current_now) * \ $(cat /sys/class/power_supply/BAT0/voltage_now) \ )) / 1000000000000 }" ; echo " W battery" echo - | awk "{printf \"%.1f\", \ $(( \ $(cat /sys/class/power_supply/BAT0/charge_now) * \ $(cat /sys/class/power_supply/BAT0/voltage_now) \ )) / 1000000000000 }" ; echo " W charging" Both charging and battery wattage – vitperov Jan 15 at 17:40

Computers generally don't track the current they are drawing. It is common that there are voltage sensors that are readable.

Power consumption can vary widely over time depending on workload. CPUs now throttle back when load is low. Disks will shutdown when idle. Tools like powertop will track processes which trigger increases in power consumption. Other tools will aggressively tune down power consumption.

UPSs care about power consumption and often have accessible data.

The manufacturers specs will give you some idea of power consumption, but reconfiguration of hardware can change power consumption. This is probably a good place to start and estimate. Adding new devices or replacing existing ones may alter the power load.

There are devices like Kill-A-Watt that can be used to measure power consumption. However, they require disconnecting the device so that the power runs through the device.

You may want to invest in or borrow a current meter which works by clipping around the wire. This would allow you to calculate volt-amps. This is typically different (higher) than the wattage for servers.

  • 1
    It's also worth noting that UPSes care both about peak as well as sustained power draw. Peak load will happen during the initial phase of power-on when everything (particularly everything mechanical like fans and spinning platter drives) starts up, and whenever the system is working really hard for some reason. Sustained and average load will almost certainly be lower for many of the reasons you mention in your answer. – user Jun 6 '13 at 11:57
  • 2
    Startup load can be significantly above the running load. On a previous project we would blow the fuses in the breaker box during startup from a full shutdown. During normal usage our load was about 30% of the fuse rating. – BillThor Jun 7 '13 at 0:23

freedektop's upower does the trick over dbus. My laptop need between 8 and 12 watts. Nice.


I don't think most servers introspect their power consumption, at least not in a form that Linux can access. You might have better luck querying the servers' LOM modules (if any), but I usually get this kind of information from remote power strips.
