Friday, 2 August 2019

Linux - Free command

This command is used to get the free space including used physical space, swapped memory in the system and buffer used by the kernel.
$ free [ options ]
# free total  used    free     shared       buffers      cached
Mem:        1021628  912548    109080           0         120368    
655548
-/+ buffers/cache:             136632       884996
Swap:       4194296    0       4194296

Options
  • -b: Displays the amount of the memory in bytes
# free -b  
total      used         free        shared     buffers  cached
Mem:       1046147072   934420480  111726592     0     123256832  
671281152
-/+ buffers/cache:      139882496  906264576  
Swap:      4294959104      0       4294959104

  • -k : Displays the amount of the memory in kilobytes
# free -k 
total     used      free     shared    buffers  cached
Mem:     1021628   912520    109108      0      120368     
655548
-/+ buffers/cache: 136604    885024
Swap:    4194296      0     4194296

  • -m: Displays the amount of the memory in megabytes
# free -m 
total  used        free    shared   buffers    cached
Mem:   997         891     106        0         117        
640
-/+ buffers/cache: 133     864
Swap:              4095     0       4095

  • -g: Displays the amount of the memory in gigabytes.
# free -g
total        used      free    shared  buffers  cached
Mem:           0        0       0        0         0
0
-/+ buffers/cache:      0       0
Swap:          3        0       3

  • -tera : Displays the amount of the memory in terabytes.

  • -h : Displays automatically the output fields with three digit numbers. Each digit will specify as follows

    • B : Bytes
    • K : KiloBytes
    • M: MegaBytes
    • G : GigaBytes
    • T : TeraBytes

  • -l : To display the detailed high and low memory size in statistical way.
# free -l  
total     used     free      shared     buffers  cache  
Mem:      1021628  912368    109260       0      120368     
655548 
Low:      890036    789064   100972 
High:     131592    123304   8288  
-/+ buffers/cache:  136452   885176 
Swap:     4194296     0      4194296

  • -s : With a digit to update the command at particular intervals.
# free -s  5  
total     used       free       shared  buffers cached
Mem:      1021628   912368      109260    0     120368     
655548
-/+ buffers/cache:  136452      885176  
Swap:     4194296     0         4194296

  • -o, --old : Display the output in old format; the only difference being this option will disable the display of the "buffer adjusted" line.
# free -ototal     used       free     shared  buffers  cached
Mem:    1021628     912520    109108    0      120368    
655548
Swap:   4194296        0     4194296

  • -V : Gives the information about the version.
  # free -V  procps version 3.2.8

  • -t : List out the total lines at the end of the command.
  # free -t  
total    used     free   shared  buffers  cached
Mem:   1021628   912520  109108    0       120368     
655548
-/+ buffers/cache:136604 885024  
Swap: 4194296     0      4194296
Total:5215924  912520    4303404

0 comments:

Post a Comment