View Single Post
Posts: 21 | Thanked: 7 times | Joined on Jul 2010 @ Ipswich, England
#10
Originally Posted by glabifrons View Post
free |grep Mem|awk '{print $3 / $2 * 100 "%"}'

For swap, simply replace Mem with Swap.
But don't forget, the total amount of memory in use isn't the same as the total memory minus memory available for other processes. Some of it may be cache or buffers (as you'll see from the raw "free" output). Your OS is happy to dump whatever's in cache of buffers if it's needed for another process.