Free (command)

From LQWiki
Jump to navigation Jump to search

free is a UNIX command which displays the total amount of free and used physical and swap memory in the system, as well as the shared memory and buffers used by the kernel.

Syntax

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

Options

[-b|-k|-m|-g]
The -b switch displays the amount of memory in bytes; the -k switch (set by default) displays it in kilobytes; the -m switch in megabytes and the -g switch in gigabytes.
[-t]
Displays a line containing the totals.
[-o]
Disables the display of a "buffer adjusted" line. Unless specified free subtracts/adds buffer memory from/to the used/free memory reports (respectively!).
[-s]
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.
[-v]
Displays version information.

Examples

Invoked on a machine with 512 MB of RAM, with the "-m" switch (to give counts in megabytes):

$ free -m
             total       used       free     shared    buffers     cached
Mem:           499        490          9          0         91        117
-/+ buffers/cache:        281        218
Swap:          964          6        958
$ 

Related Commands

  • df - Lists free space on disks
  • ps - Lists processes
  • slabtop - 'Realtime' list of slab cache information
  • top - 'Realtime' list of processes/memory/CPU states etc.