Part of Slepp's ProjectsPastebinTURLImagebinFilebin
Feedback -- English French German Japanese
Create Upload Newest Tools Donate

Advertising

Paste Description for Unnamed

a simple BASH script for GNU-Linux

Unnamed
Friday, February 2nd, 2007 at 7:36:01am UTC 

  1. #!/bin/sh
  2. #
  3. # a script to simply display the accurate memory usage for the linux system.
  4. # 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
  5. # rights of others to use, and do the same with it.   thank you !
  6. #
  7. #
  8. #
  9. mem="`cat /proc/meminfo | tr "\n" "#" | tr -d "[A-z] :"`"
  10. memused="$(((`echo "$mem" | cut -d'#' -f1` - `echo "$mem" |\
  11. cut -d'#' -f2` - `echo "$mem" | cut -d'#' -f3` - `echo "$mem" |\
  12.   cut -d'#' -f4`) / 1024))"
  13. memtotal="$((`echo "$mem" | cut -d'#' -f1` / 1024))"
  14. memper="$((($memused * 100) / $memtotal))"
  15. 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.

update paste below
details of the post (optional)

Note: Only the paste content is required, though the following information can be useful to others.

Save name / title?

(space separated, optional)



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.

comments powered by Disqus
worth-right
worth-right