free Command in Linux



NAME

free Display amount of free and used memory in the system

SYNOPSIS

free [-b | -k | -m] [-o] [-s delay ] [-t] [-l] [-V]

DESCRIPTION

free displays the total amount of free and used physical and swap memory in the system, as well as the buffers used by the kernel. The shared memory column should be ignored; it is obsolete.

OPTIONS

TAG DESCRIPTION
-b The -b switch displays the amount of memory in bytes; the -k switch (set by default) displays it in kilobytes; the -m switch displays it in megabytes.
-t The -t switch displays a line containing the totals.
-o The -o switch disables the display of a "buffer adjusted" line. If the -o option is not specified, free subtracts buffer memory from the used memory and adds it to the free memory reported
-s The -s switch activates continuous polling delay seconds apart. You may actually specify any floating point number for delay, usleep(3) is used for microsecond resolution delay times.
-l The -l switch shows detailed low and high memory statistics
-V The -V switch displays version information.
x Extract members (named member) from the freechive. You can use the v modifier with this operation, to request that free list each name as it extracts it.

If you do not specify a member, all files in the freechive freee extracted.

Files cannot be extracted from a thin freechive.

EXAMPLES

EXAMPLE-1:

Free command used to check the used and available space of physical memory and swap memory in KB.

# free

output:
# free
             total       used       free     shared    buffers     cached
Mem:       1000192     465672     534520        176      55088     175212
-/+ buffers/cache:     235372     764820
Swap:      1044476      12372    1032104

EXAMPLE-2:

Free command with option -b, display the size of memory in Bytes.

# free -b

output:
# free -b
             total       used       free     shared    buffers     cached
Mem:    1024196608  476831744  547364864     180224   56418304  179400704
-/+ buffers/cache:  241012736  783183872
Swap:   1069543424   12668928 1056874496

EXAMPLE-3:

Free command with option -k, display the size of memory in (KB) Kilobytes.

# free -k

output:
# free -k
             total       used       free     shared    buffers     cached
Mem:       1000192     465640     534552        176      55096     175196
-/+ buffers/cache:     235348     764844
Swap:      1044476      12372    1032104

EXAMPLE-4:

To see the size of the memory in (MB) Megabytes use option as -m.

# free -m

output:
# free -m
             total       used       free     shared    buffers     cached
Mem:           976        454        522          0         53        171
-/+ buffers/cache:        229        746
Swap:         1019         12       1007

EXAMPLE-5:

Using -g option with free command, would display the size of the memory in GB(Gigabytes)

# free -g

output:
# free -g
             total       used       free     shared    buffers     cached
Mem:             0          0          0          0          0          0
-/+ buffers/cache:        0          0
Swap:            0          0          0

EXAMPLE-6:

Free command with -t option, will list the total line at the end.

# free -t

output:
# free -t
             total       used       free     shared    buffers     cached
Mem:       1000192     465640     534552        176      55096     175196
-/+ buffers/cache:     235348     764844
Swap:      1044476      12372    1032104
Total:     2044668     478012    1566656

EXAMPLE-7:

By default the free command display “buffer adjusted” line, to disable this line use option as -o

# free -o

output:
# free -o
             total       used       free     shared    buffers     cached
Mem:       1000192     465640     534552        176      55096     175196
Swap:      1044476      12372    1032104

EXAMPLE-8:

The -s option with number, used to update free command at regular intervals.

# free -s 5
This command displays output every 5 seconds.

output:
# free -s 5
             total       used       free     shared    buffers     cached
Mem:       1000192     465640     534552        176      55096     175196
-/+ buffers/cache:     235348     764844
Swap:      1044476      12372    1032104

             total       used       free     shared    buffers     cached
Mem:       1000192     465656     534536        176      55096     175196
-/+ buffers/cache:     235364     764828
Swap:      1044476      12372    1032104

             total       used       free     shared    buffers     cached
Mem:       1000192     465656     534536        176      55096     175196
-/+ buffers/cache:     235364     764828
Swap:      1044476      12372    1032104

EXAMPLE-9:

* The -l switch displays detailed high and low memory size statistics.

# free -l

output:
# free -l
             total       used       free     shared    buffers     cached
Mem:       1000192     465640     534552        176      55096     175196
Low:       1000192     465640     534552
High:            0          0          0
-/+ buffers/cache:     235348     764844
Swap:      1044476      12372    1032104
Advertisements