module LinuxUtilinfo::MemoryMethods

Public Instance Methods

get_total_memory() click to toggle source
# File lib/linux_utilinfo/memory_methods.rb, line 3
def get_total_memory
                memory_total_in_kb = `cat /proc/meminfo | grep -i 'MemTotal' | awk '{print $2}'`.to_i 
                memory_total_in_kb /= (1000**2)
                memory_total_in_gb = "#{memory_total_in_kb}GB"
                return memory_total_in_gb
end