Pages

Script to print the RAM size

Here is a script that prints the RAM size of a system using the information from /proc/cpuinfo . I couldn't come across a command that gives only the ram size info in a user friendly way, hence wrote this to make it easier to view only the RAM size.

ramsize.sh: Save the script as ramsize.sh,give it execute permission using chmod and execute the script as follows.

It gives the output in MB.

2 comments:

  1. awk '{if(/MemTotal/){if($3=="kB"){$2/=1000;$3="MB"}; print $2,$3}}' /proc/meminfo

    ReplyDelete
    Replies
    1. That sure is much more compact one :-) . Thank you

      Delete