Advertising
Paste Description for Someone
bash script to take the confusion out of the 'free' command.
- Someone
- Saturday, February 24th, 2007 at 5:33:40am UTC
- #!/bin/sh
- #
- # a script to simply display the accurate memory usage for the linux system.
- # gnu-gpl feel free to copy edit or any any other change use or abuse this code,# so long as you don't try to claim ownership thereof to the exclusion of the
- # rights of others to use, and do the same with it. thank you !
- #
- mem=(`cat /proc/meminfo | tr -d "[A-z] :" | tr "\n" " " | cut -d' ' -f-4`)
- memused="$((( ${mem[0]} - ${mem[1]} - ${mem[2]} - ${mem[3]} ) / 1024))"
- memtotal="$(( ${mem[0]} / 1024))"
- memper="$((( $memused * 100 ) / $memtotal ))"
- echo "Mem usage: $memused/$memtotal MB ($memper%)"
advertising
Update the Post
Either update this post and resubmit it with changes, or make a new post.
You may also comment on this post.
Please note that information posted here will not expire by default. If you do not want it to expire, please set the expiry time above. If it is set to expire, web search engines will not be allowed to index it prior to it expiring. Items that are not marked to expire will be indexable by search engines. Be careful with your passwords. All illegal activities will be reported and any information will be handed over to the authorities, so be good.