ref : http://sysdigg.blogspot.com/2007/12/how-to-check-memory-size-in-linux.html
How to check Memory size in Linux
In all Linux operating Systems memory size can be checked by running dmesg,free, top and using Kernel proc information. Linux is very cool it offers various pre-installed tools and commands to check memory size compared to UNIX Operating systems.
To check memory size in Linux using dmesg, run the following command:
[root@earth ~]# dmesg |grep -i memory
Memory: 4084332k/4653052k available (1868k kernel code, 43456k reserved, 755k data, 180k init, 3211208k highmem)
Running dmesg command in Linux displays memory in kilobytes, on this Linux server total memory size is 4 Gg.For checking memory dmesg command is also available in Solaris and HP-UX.To check memory size in linux using /proc information run following from the command line:
[root@svn ~]# cat /proc/meminfo |grep -i memtotal
MemTotal: 4086484 kB
/proc/meminfo shows total memory size configured as 4086484 displayed in kilobytes (KB).
To check memory size on Linux using free command, run the following:
[root@svn ~]# free
total used free shared buffers cached
Mem: 4086484 4033924 52560 0 71764 3122188
-/+ buffers/cache: 839972 3246512
Swap: 4194216 376 4193840
Free command on linux also displays used,free memory,cached memory ,shared and memory
buffer size. You can use –m option to check Linux memory utilization in megabytes:
[root@svn ~]# free -m
total used free shared buffers cached
Mem: 3990 3523 467 0 69 2649
-/+ buffers/cache: 804 3185
Swap: 4095 1 4094
Linux also comes with top command, top can be run to check real memory size and memory utilization.Top display total memory size,used memory,free memory ,memory buffers size and swap memory utilization :
top - 08:05:36 up 6 days, 16:46, 7 users, load average: 0.07, 0.09, 0.08
Tasks: 131 total, 1 running, 130 sleeping, 0 stopped, 0 zombie
Cpu(s): 4.2% us, 0.5% sy, 0.0% ni, 95.3% id, 0.0% wa, 0.0% hi, 0.0% si
Mem: 4086484k total, 3609956k used, 476528k free, 71752k buffers
Swap: 4194216k total, 1100k used, 4193116k free, 2713504k cached
Ubuntu and fedora linux also comes with package called lshw (list hardware) which provides
detailed information on memory size, how many memory dims available, memory slots free along with other Linux system Hardware information .Run lshw and scroll down to *-memory section :
#lshw |grep
*-memory
description: System Memory
physical id: 39
slot: System board or motherboard
size: 1GB
No comments:
Post a Comment