Skip to content

Instantly share code, notes, and snippets.

@HalCanary
Created September 24, 2021 14:07
Show Gist options
  • Save HalCanary/04080b482bb61ea79b1dbb87be5a96eb to your computer and use it in GitHub Desktop.
Save HalCanary/04080b482bb61ea79b1dbb87be5a96eb to your computer and use it in GitHub Desktop.
disc_useage_darwin.sh
#!/bin/sh
INFO="$(diskutil ap list disk1)"
printf 'size: %14d\n' "$(printf %s "$INFO" | sed -n 's/ *Size (Capacity Ceiling): *\([0-9]*\).*/\1/p')"
printf 'use: %14d\n' "$(printf %s "$INFO" | sed -n 's/ *Capacity In Use By Volumes: *\([0-9]*\).*/\1/p')"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment