Skip to content

Instantly share code, notes, and snippets.

@aar0nTw
Created June 7, 2013 09:48
Show Gist options
  • Save aar0nTw/5728228 to your computer and use it in GitHub Desktop.
Save aar0nTw/5728228 to your computer and use it in GitHub Desktop.
/usr/sbin/ioreg -l | awk 'BEGIN{a=0;b=0}
$0 ~ "MaxCapacity" {a=$5;next}
$0 ~ "CurrentCapacity" {b=$5;nextfile}
END{printf("%.2f%%", b/a * 100)}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment