Most useful Linux Free command with examples – A tool to monitor memory usage

In this article, you will learn how to use Linux free Command to check memory usage. As we know, memory is one of the main components of computers. We have two types of memory in our system, namely physical memory and virtual memory. Physical memory is nothing more than RAM and SWAP partition, for which a Virtual Memory.RAM stands random access memory Used to store information used by the operating system and improve system performance. The swap partition, also known as SWAP storage, can be used by the system administrator if he believes that the physical storage is full or wants to improve system performance. The SWAP memory takes memory from the hard disk.

Most useful Linux Free command with examples – A tool to monitor memory usage

Now there should be some tools to monitor this memory usage, and every Linux administrator would also like to know how much memory is being used and how much is available for further use. For this we have a nice tool in Linux free Command. Under Linux you get the following information about memory usage free Command:

  • Storage information (Available reminder. Free space, Etc.)
  • Swap space information (Available reminder. Free space, Etc.)
  • Buffer related information
  • Information about cached memory

Most useful Linux Free command with examples – A tool to monitor memory usage:

How to check memory usage information like Total memory available. Memory used. Free space. Divided. buffer and cached memory. Swap language / memory usage Information that you can easily carry out free Command. See the following command.

[[email protected] ~]# 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 the total memory usage

free Linux command with argument -t shows you the total memory usage. Highlighted below.

[[email protected] ~]# 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 the low and high memory usage

You can use the free with argument command to check the use of little and lots of memory -l,

[[email protected] ~]# 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 adjustment

free Linux command with argument prints memory usage by disabling buffer adjustment.

With only free command you can see a buffer adjustment. Refer to the issue below.

[[email protected] ~]# free
             total       used       free     shared    buffers     cached
Mem:       1012352     912884      99468          0      30348     540552
-/+ buffers/cache:     341984     670368
Swap:      2031608        336    2031272

Now execute the free command with the argument , You won’t find the buffer. Refer to the sample output below.

[[email protected] ~]# 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 memory usage in different size units such as bytes, MB, GB, TB, etc.

free Linux command with argument -b prints the memory usage in bytes. See the following command.

[[email protected] ~]# 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 outputs the memory usage in KB (kilobytes).

[[email protected] ~]# 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 memory usage in megabytes (MB) by using the free Linux command with an argument -m,

[[email protected] ~]# 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 outputs the memory usage in GB (gigabytes).

[[email protected] ~]# 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 run the following command to check the memory usage information.

[[email protected] ~]# 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 version of the installed package of the free command, use the free command with an argument -V,

[[email protected] ~]# free -V   # To check the free Linux command Package Version
procps version 3.2.8

For more information about the free Linux command, see the following command.

[[email protected] ~]# man free   # For more Information related free Linux  command

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

That’s all. In this article, we have explained the most useful free Linux command with Examples A. Memory usage monitor tool, I hope you like this article. If you like this article, just share it. If you have any questions about this article, please comment.

Sidebar