FREE(1)

๐Ÿ’– FREE(1) โ€” the "how much RAM do I even have left" page ๐Ÿ’–

okay bestie, pull up a chair, because this is genuinely one of the most useful little commands on your whole system and I need you to be obsessed with it. it's free, it lives in the General Commands Manual section, and it's giving "tell me everything about my memory right now" energy. ๐Ÿงšโœจ


โœจ NAME โœจ

free โ€” display amount of free and used memory in the system ๐Ÿซถ


๐ŸŒธ SYNOPSIS ๐ŸŒธ

free [option ...]

๐Ÿ’œ DESCRIPTION ๐Ÿ’œ

so like, free shows you the total amount of free and used physical and swap memory in your system, plus the buffers and caches the kernel is holding onto. where does it get this tea from? it gathers everything by parsing /proc/meminfo. iconic behavior honestly.

here are the columns it serves you, one by one ๐Ÿ‘‘

  • total โ€” total usable memory (MemTotal and SwapTotal in /proc/meminfo). this is physical and swap memory minus a few reserved bits and kernel binary code. the math is mathing, don't worry about it.
  • used โ€” used or unavailable memory, calculated as total - available. that's it, that's the formula, no cap.
  • free โ€” unused memory (MemFree and SwapFree in /proc/meminfo). the sad little number we all stare at ๐Ÿ˜ญ
  • shared โ€” memory used (mostly) by tmpfs (Shmem in /proc/meminfo).
  • buffers โ€” memory used by kernel buffers (Buffers in /proc/meminfo).
  • cache โ€” memory used by the page cache and slabs (Cached and SReclaimable in /proc/meminfo).
  • buff/cache โ€” literally just the sum of buffers and cache. bestie behavior: they hold hands. ๐Ÿซถ
  • available โ€” an estimation of how much memory is available for starting new applications, without swapping. and listen, this one is different from cache or free on purpose: it takes into account page cache, and also the fact that not all reclaimable memory slabs will actually get reclaimed, because some items are still in use. this is MemAvailable in /proc/meminfo โ€” available on kernels 3.14, emulated on kernels 2.6.27+, and otherwise it's just the same as free.

๐Ÿ’… OPTIONS ๐Ÿ’…

  • -b, --bytes โ€” display the amount of memory in bytes.
  • -k, --kibi โ€” display the amount of memory in kibibytes. this is the default, so if you do nothing, this is what you get. ๐Ÿ’ซ
  • -m, --mebi โ€” display the amount of memory in mebibytes.
  • -g, --gibi โ€” display the amount of memory in gibibytes.
  • --tebi โ€” display the amount of memory in tebibytes.
  • --pebi โ€” display the amount of memory in pebibytes.
  • --kilo โ€” display the amount of memory in kilobytes. implies --si.
  • --mega โ€” display the amount of memory in megabytes. implies --si.
  • --giga โ€” display the amount of memory in gigabytes. implies --si.
  • --tera โ€” display the amount of memory in terabytes. implies --si.
  • --peta โ€” display the amount of memory in petabytes. implies --si.
  • -h, --human โ€” show all output fields automatically scaled to the shortest three digit unit, and display the units of the print out. these are the units it uses, bestie:
B  = bytes
Ki = kibibyte
Mi = mebibyte
Gi = gibibyte
Ti = tebibyte
Pi = pebibyte
and here's the lil caveat: if the unit is missing, and you have exbibyte of RAM or swap, the number is in tebibytes and the columns might not be aligned with the header. ๐Ÿ˜ฌ it's giving "we tried our best."
  • -w, --wide โ€” switch to the wide mode. wide mode produces lines longer than 80 characters. in this mode, buffers and cache are reported in two separate columns. so much room, so much info. ๐Ÿ‘‘
  • -c, --count count โ€” display the result count times. requires the -s option, so don't forget your bestie -s. ๐Ÿซถ
  • -l, --lohi โ€” show detailed low and high memory statistics.
  • -L, --line โ€” show output on a single line, often used with the -s option to show memory statistics repeatedly. it's giving "one line, endless tea."
  • -s, --seconds delay โ€” continuously display the result delay seconds apart. you may actually specify any floating point number for delay, using either . or , for the decimal point (yes really, both). usleep(3) is used for microsecond resolution delay times. precision queen โœจ
  • --si โ€” use kilo, mega, giga etc (power of 1000) instead of kibi, mebi, gibi (power of 1024). pick your lore.
  • -t, --total โ€” display a line showing the column totals.
  • -v, --committed โ€” display a line showing the memory commit limit and the amount of committed/uncommitted memory. the total column on this line will display the memory commit limit. this line is relevant if memory overcommit is disabled. on systems with memory overcommit enabled, the free value can temporarily appear negative.
NOT A BUG, bestie, i promise!! it's an effect of overcommit โ€” the system has promised more memory than the total of its virtual address space. the negative value indicates the magnitude of the system's memory over-allocation. ๐Ÿ’€ so if you see a negative number, that's the system being extra, not free lying to you.
  • --help โ€” print help.
  • -V, --version โ€” display version information.

๐Ÿ“ FILES ๐Ÿ“

  • /proc/meminfo โ€” memory information. the source of all the tea. โ˜•

๐Ÿ’€ BUGS ๐Ÿ’€

the value for the shared column is not available from kernels before 2.6.32, and is displayed as zero. so if you're on some ancient kernel and wondering why shared is giving nothing, that's why ๐Ÿ™ˆ

please send bug reports to procps@freelists.org. they're lovely, be nice. ๐Ÿ’–


๐ŸŒˆ SEE ALSO ๐ŸŒˆ

ps(1), slabtop(1), top(1), vmstat(8).


and that's the whole page, bestie!! this absolute icon of a manpage came to you from procps-ng, dated 2023-05-02, and it's genuinely one of the most "iykyk" commands in your toolbox. go check your RAM, it's free real estate (or it's not, and now you'll know exactly why). ๐Ÿ’…โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from