Linux: Used/free memory percentage

#This will report the percentage of memory in use % free | grep Mem | awk '{print $3/$2 * 100.0}' #Ex:23.8171 #This will report the percentage of memory that's free % free | grep Mem | awk '{print $4/$2 * 100.0}' #Ex:76.5013 #You could create an alias for this command or put this into a tiny shell script. The specific output could be tailored to your needs using formatting commands for the print statement along these lines: free | grep Mem | awk '{ printf("free: %.4f %\n", $4/$2 * 100.0) }'

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.