MOST USEFUL LINUX FREE COMMAND WITH EXAMPLES – A MEMORY USAGE MONITOR TOOL
Introduction
In this article we are going to learn How we can use Linux free command to check Memory Usage.
As we know that Memory is one of the major part of computers. We have two types of Memory in our system i.e. Physical Memory and Virtual Memory. Physical memory is nothing but RAM and SWAP partition is known a Virtual Memory.RAM stands for Random Access Memory used to store informations used by Operating System and improve the system performance and Swap Partition also referred as SWAP Space can be use by system administrator if he feels that the Physical Memory got full or if he want to increase the performance of the system. SWAP space take memory from Harddisk.
Now there should be some tools to Monitor these memory usages and also every Linux Administrator would want to know how much amount of memory used and how much is available for further usage. For that We have a nice tool in Linux is free command. You will able to get below Memory Usage Informations using Linux free command :
- Memory Information (Available Memory, Free Memory..etc….)
- Swap Space Information (Available Memory, Free Memory..etc….)
- Buffer Related Information
- Cached Memory Information
Check Memory Usage using Linux free command
To check Memory usage Information like Total Available Memory, Used Memory, Free Memory, Shared, Buffer and cached Memory, Swap spache/Memory Usage Information you can just run the free command. Refer the command below.
[root@localhost ~]# free # To check Memory Usage & Swap Usage
total used free shared buffers cached
Mem: 1012352 913740 98612 0 30020 540364
-/+ buffers/cache: 343356 668996
Swap: 2031608 336 2031272
Check Total Memory Usage
Linux free command with argument -t will show you the Total Memory Usage. Highlighted Below.
[root@localhost ~]# free -t # Checking Total Memory Usage total used free shared buffers cached Mem: 1012352 913624 98728 0 30084 540496 -/+ buffers/cache: 343044 669308 Swap: 2031608 336 2031272 Total: 3043960 913960 2130000
Check Low and High Memory Usage
To check Low Memory Usage and High Memory Usage you can use free command with argument -l.
[root@localhost ~]# free -l # To check Low & High Memory Usage total used free shared buffers cached Mem: 1012352 913724 98628 0 30148 540500 Low: 1012352 913724 98628 High: 0 0 0 -/+ buffers/cache: 343076 669276 Swap: 2031608 336 2031272
Also Read :
- BEST USEFUL LINUX DF COMMAND WITH EXAMPLES
- USEFUL LINUX FDISK COMMAND WITH EXAMPLES – A LINUX DISK PARTITION TOOL
Check Memory Usage by disabling Buffer Adjust
Linux free command with argument -o will print the memory usage by disabling buffer adjust.
By only free command you will able to see a buffer adjust. Refer the output below.
[root@localhost ~]# free
total used free shared buffers cached
Mem: 1012352 912884 99468 0 30348 540552
-/+ buffers/cache: 341984 670368
Swap: 2031608 336 2031272
Now let’s run the free command with argument -o. You will not found the Buffer. Refer the sample output below.
[root@localhost ~]# free -o # Check Memory Usage by disabling Buffer Adjust
total used free shared buffers cached
Mem: 1012352 912884 99468 0 30348 540552
Swap: 2031608 336 2031272
Check Memory Usage in Bytes
We can check the memory usage in various size units like in Bytes, MB, GB, TB..etc….
Linux free command with argument -b will print the memory usage in Bytes. Refer the command below.
[root@localhost ~]# free -b # Check memory usage in Bytes
total used free shared buffers cached
Mem: 1036648448 935501824 101146624 0 30756864 553332736
-/+ buffers/cache: 351412224 685236224
Swap: 2080366592 344064 2080022528
Check Memory Usage in KB (Kilobytes)
free command with argument -k will print the memory usage in KB (Kilobytes).
[root@localhost ~]# free -k # Checking Memory Usage in Kilobytes
total used free shared buffers cached
Mem: 1012352 913608 98744 0 30052 540424
-/+ buffers/cache: 343132 669220
Swap: 2031608 336 2031272
Check Memory Usage in MB (Megabytes)
You can check the memory usage in MB (Megabytes) by using Linux free command with argument -m.
[root@localhost ~]# free -m # Checking memory usage in MB (Megabytes)
total used free shared buffers cached
Mem: 988 892 96 0 29 527
-/+ buffers/cache: 335 653
Swap: 1983 0 1983
Check Memory Usage in GB (Gigabytes)
free command with argument -g will print the memory usage in GB (Gigabytes).
[root@localhost ~]# free -g # Checking Memory Usage in Gigabytes
total used free shared buffers cached
Mem: 0 0 0 0 0 0
-/+ buffers/cache: 0 0
Swap: 1 0 1
You can also follow the below command to check the Memory Usage Information.
[root@localhost ~]# cat /proc/meminfo # To check Memory Usage Information
MemTotal: 1012352 kB
MemFree: 104556 kB
Buffers: 31172 kB
Cached: 540560 kB
SwapCached: 136 kB
Active: 247016 kB
Inactive: 516832 kB
Active(anon): 64608 kB
Inactive(anon): 131300 kB
Active(file): 182408 kB
To check Installed Package version of free command use the free command with argument -V.
[root@localhost ~]# free -V # To check the Linux free command Package Version
procps version 3.2.8
For more Information Information related Linux free command refer the below command.
[root@localhost ~]# man free # For more Information related Linux free command
If you found this article useful then Like Us, Share Us, Subscribe our Newsletter OR if you have something to say then feel free to comment on the comment box below.