Module: LinuxUtilinfo::MemoryMethods

Included in:
LinuxUtilinfo
Defined in:
lib/linux_utilinfo/memory_methods.rb

Instance Method Summary collapse

Instance Method Details

#get_total_memoryObject



3
4
5
6
7
8
# 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