Linux and Unix free command
|-b, --bytes||Display the amount of memory in bytes.|
|-k, --kilo||Display the amount of memory in kilobytes. This is the default.|
|-m, --mega||Display the amount of memory in megabytes.|
|-g, --giga||Display the amount of memory in gigabytes.|
|--tera||Display the amount of memory in terabytes.|
|-h, --human||Show all output fields automatically scaled to shortest three digit unit and display the units of print out. Following units are used.
B = bytes
K = kilos
M = megas
G = gigas
T = teras
If you have a petabyte of RAM or swap, the number is in terabytes and your computer is awesome.
|-c, --count count||Display the result count times. Requires the -s option.|
|-l, --lohi||Show detailed low and high memory statistics.|
|-o, --old||Display the output in old format; the only difference being this option will disable the display of the "buffer adjusted" line.|
|-s, --seconds seconds||Continuously display the result delay seconds apart. You may actually specify any floating point number for delay, usleep(3) is used for microsecond resolution delay times.|
|--si||Use power of 1000 not 1024.|
|-t, --total||Display a line showing the column totals.|
|-V, --version||Display version information.|
Running free with no options will display a chart similar to the example below.
total used free shared buffers cached Mem: 1006708 935872 70836 0 148244 346656 -/+ buffers/cache: 440972 565736 Swap: 262140 130084 132056
Tip: When using the free command the two important lines are the -/+ buffers/cache line and Swap line. If you're wanting to get a good idea on how much free memory is available, the free section in the buffers/cache is what you should be reading. Linux will keep the contents of memory in the buffers to help having to access the same data over-and-over from the slower disk drive. If your buffers/cache free memory is low or your swap free is low a memory upgrade is necessary.
free -ms 5
The above command will display the memory in megabytes with the "s 5" telling the system to continuously poll the data and display the results.
This command is similar to the command mentioned above and uses watch to display the current memory usage.