Cool Solutions

Determining Total System RAM for Use in ZENworks Imaging Scripts


January 23, 2008 6:55 am

Reads: 5673



Someone in the Novell Support Forums was asking for some help on how to determine how much total system RAM was in a computer.

If the amount of RAM was greater than 512 megs, then he wanted to restore an add-on image for an application which required 512+ megs of RAM to run properly.

I was able to use the following command to output the total amount of system RAM into the variable RAMTOAL:

RAMTOTAL=`free | awk ‘/Mem:/ {print $2}’`

You can verify this by typing:


On my test system I see the following output:

Note that my total RAM is listed as 516352.

Then type:


The value stored in the variable RAMTOTAL evaluates to 516352.

You could do something similar for “Used RAM” and “Free RAM”, though it is probably not as useful:

RAMUSED=`free | awk ‘/Mem:/ {print $3}’`
RAMFREE=`free | awk ‘/Mem:/ {print $4}’`

VN:F [1.9.22_1171]
Rating: 0.0/5 (0 votes cast)

Categories: Uncategorized

Disclaimer: This content is not supported by Novell. It was contributed by a community member and is published "as is." It seems to have worked for at least one person, and might work for you. But please be sure to test it thoroughly before using it in a production environment.