This simple tutorial explains you how to check ram usage and free memory in linux. We can find out the memory using command line and GUI tools.linux, commands, tips and tricks

1. free – This command allows you check the RAM usage and free memory. This command will display memory in bytes.

$free

root@linuxinternetworks:~ # free
total used free shared buffers cached
Mem: 2084476 950656 1133820 0 76152 589956
-/+ buffers/cache: 284548 1799928
Swap: 1998844 0 1998844

To display RAM usage and free in MB, use free -m

$free -m

root@linuxinternetworks:~ # free -m
total used free shared buffers cached
Mem: 2035 928 1107 0 74 576
-/+ buffers/cache: 277 1757
Swap: 1951 0 1951

To display RAM usage and free in GB, use free -g

$free -g

root@linuxinternetworks:~ #free -g
total used free shared buffers cached
Mem: 1 0 1 0 0 0
-/+ buffers/cache: 0 1
Swap: 1 0 1

2. vmstat РIt displays information about processes, memory, paging, block IO, traps, disks and cpu activity

This command displays the RAM memory usage in MB. This command is an alternative to free -m

$vmstat -S M

root@linuxinternetworks:~ # vmstat -S M
procs ——memory—– -swap- -io- system —-cpu—-
r b swpd free buff cache si so bi bo in cs us sy id wa
3 0 0 1111 74 572 0 0 597 25 163 275 10 8 79 3

This command displays the RAM memory usage in KB. This command is an alternative to free

$vmstat -S K

root@linuxinternetworks:~ # vmstat -S K
procs ——memory—– -swap- -io- system —-cpu—-
r b swpd free buff cache si so bi bo in cs us sy id wa
1 0 0 1134292 76152 589524 0 0 449 21 150 244 8 6 83 2

These command displays the memory usage every second for 10 times in KB (kilobytes)

$vmstat -a -n 1 10

$vmstat -a -S K 1 10

root@linuxinternetworks:~ #vmstat -a -S K 1 10
procs ——-memory——- -swap- -io- system —-cpu—-
r b swpd free inact active si so bi bo in cs us sy id wa
0 0 0 1134160 558416 336656 0 0 428 20 148 241 8 6 83 2
3 0 0 1133828 558416 336796 0 0 0 0 151 223 9 23 68 0
0 0 0 1134028 558416 336724 0 0 0 4 172 435 10 31 59 0
0 0 0 1134028 558416 336724 0 0 0 0 114 154 8 2 90 0
0 0 0 1134028 558416 336724 0 0 0 0 96 126 4 0 96 0
0 0 0 1134028 558416 336724 0 0 0 48 127 158 7 6 87 0
0 0 0 1134028 558416 336724 0 0 0 0 101 138 5 3 92 0
1 0 0 1134028 558412 336728 0 0 0 0 105 140 5 2 93 0
0 0 0 1134028 558412 336728 0 0 0 0 98 137 2 2 96 0
0 0 0 1134028 558412 336728 0 0 0 60 119 171 3 2 91 4

This command displays the memory usage every seconds for 10 times in MB (megabytes)

$vmstat -a -S M 1 10

root@linuxinternetworks:~ #vmstat -a -S M 1 10
procs ——-memory——- -swap- -io- system —-cpu—-
r b swpd free inact active si so bi bo in cs us sy id wa
0 0 0 1107 545 328 0 0 382 19 144 231 7 6 85 2
1 0 0 1107 545 328 0 0 0 0 89 139 3 1 96 0
1 0 0 1107 545 328 0 0 0 0 87 137 1 1 98 0
2 0 0 1107 545 328 0 0 0 0 100 132 3 2 95 0
1 0 0 1107 545 328 0 0 0 32 117 160 5 2 93 0
1 0 0 1107 545 328 0 0 0 0 97 133 5 3 92 0
1 0 0 1107 545 328 0 0 0 32 120 150 7 7 86 0
1 0 0 1107 545 328 0 0 0 0 96 132 3 2 95 0
2 0 0 1107 545 328 0 0 0 0 105 149 4 1 95 0
5 0 0 1107 545 329 0 0 0 0 183 380 6 40 54 0

3. ¬†– It’s a graphical interface tool which shows the memory graph

For more about linux memory related information and tutorial check here.

If you are using any other tools, please let me know through commands.


Subscribe Our Free Newsletter

Delivered by FeedBurner. We Respect Your Privacy

Tagged with:
 

Leave a Reply

%d bloggers like this: