Monday, May 23, 2011

finding the memory size in Linux

To my knowledge there are three command to find the memory in Linux:

1)free command:

It is used to print the memory size in bytes by default

>> free
total used free shared buffers cached
Mem: 16438664 16294220 144444 0 235596 13380932
-/+ buffers/cache: 2677692 13760972

options:

-b - to print the bytes

-m - to print the information in MegaBytes

-k - to print the information in kilobytes.

>>free -m
total used free shared buffers cached
Mem: 16053 15953 100 0 214 13119
-/+ buffers/cache: 2619 13433
Swap: 9855 1 9854


2)Top command:

It is used to display the ongoing process in the Cpu and the memory used by the same.

>>Top
PID USERNAME THR PRI NICE SIZE RES SHR STATE TIME CPU COMMAND
4536 root 1 0 -20 37M 8696K 2204K sleep 189:47 1.60% mount
23308 karthik 1 15 0 18M 5948K 4392K sleep 0:00 1.60% vim
3754 root 1 16 0 10M 680K 584K sleep 3:03 0.20% vi


3)dmesg | grep ^Memory
This also gives the information about the available memory.

> dmesg | grep ^Memory
Memory for crash kernel (0x0 to 0x0) notwithin permissible range
Memory: 16435064k/17563644k available (2577k kernel code, 339988k reserved, 1305k data, 212k init

No comments:

Post a Comment