Skip to content

Instantly share code, notes, and snippets.

@martinapugliese
Last active October 15, 2018 16:33
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save martinapugliese/62124d02f9eec7fcbd67e58a83e452a8 to your computer and use it in GitHub Desktop.
Save martinapugliese/62124d02f9eec7fcbd67e58a83e452a8 to your computer and use it in GitHub Desktop.

A collection of useful command line hacks (Unix)

Memory usage

MACOS

vm_stat is the command, this makes output user friendly, thanks to this.

vm_stat | perl -ne '/page size of (\d+)/ and $size=$1; /Pages\s+([^:]+)[^\d]+(\d+)/ and printf("%-16s % 16.2f Mi\n", "$1:", $2 * $size / 1048576);'

Linux

free -m
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment