Most Useful Linux Free Command With Examples – A Memory Usage Monitor Tool

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 parts 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 information used by Operating System and improve the system performance and Swap Partition also referred to as SWAP Space can be used by the system administrator if he feels that the Physical Memory got full or if he want to increase the performance of the system. SWAP space takes memory from Harddisk.

Most Useful Linux Free Command With Examples – A Memory Usage Monitor Tool

Most Useful Linux Free Command With Examples – A Memory Usage Monitor Tool

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 that is free to command. You will able to get below Memory Usage Informations using Linux free command :

  • Memory Information (Available MemoryFree Memory, etc.)
  • Swap Space Information (Available MemoryFree Memory, etc.)
  • Buffer Related Information
  • Cached Memory Information

Most Useful Linux Free Command With Examples – A Memory Usage Monitor Tool:

To check Memory usage Information like Total Available MemoryUsed MemoryFree MemorySharedBuffer and cached MemorySwap space/Memory Usage Information you can just run the free command. Refer to 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

free Linux 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 the 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

Check Memory Usage by disabling Buffer Adjust

free Linux 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 to 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 to 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….

free Linux command with argument -b will print the memory usage in Bytes. Refer to 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 the free Linux 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 the Installed Package version of the free command uses the free command with argument -V.

[root@localhost ~]# free -V   # To check the free Linux command Package Version
procps version 3.2.8

For more Information related to free Linux, command refers to the below command.

[root@localhost ~]# man free   # For more Information related free Linux  command

Also Read : Useful Linux Fdisk Command With Examples – A Linux Disk Partition Tool

That’s all, In this article, we have explained the Most Useful Linux Free Command With Examples – A Memory Usage Monitor Tool. I hope you enjoy this article. If you like this article, then just share it. If you have any questions about this article, please comment.

Share this:

Mangesh Dhulap

This is Mangesh Dhulap the Founder and Editor of IT SMART TRICKS have 6+ years of Industrial Experience. We expect from our visitors to like, share, and comment on our posts.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.