2002-02-02 04:17:29 +05:30
|
|
|
.\" -*-Nroff-*-
|
|
|
|
.\" This page Copyright (C) 1993 Matt Welsh, mdw@sunsite.unc.edu.
|
2011-04-18 23:00:21 +05:30
|
|
|
.\" Long options where added at April 15th, 2011.
|
2002-02-02 04:17:29 +05:30
|
|
|
.\" Freely distributable under the terms of the GPL
|
2015-04-03 13:48:58 +05:30
|
|
|
.TH FREE 1 "Apr 2015" "procps-ng" "User Commands"
|
2002-02-02 04:17:29 +05:30
|
|
|
.SH NAME
|
|
|
|
free \- Display amount of free and used memory in the system
|
|
|
|
.SH SYNOPSIS
|
2011-02-23 13:47:54 +05:30
|
|
|
.B free
|
2011-09-28 02:34:35 +05:30
|
|
|
.RI [ options ]
|
2002-02-02 04:17:29 +05:30
|
|
|
.SH DESCRIPTION
|
2011-09-28 02:34:35 +05:30
|
|
|
.B free
|
|
|
|
displays the total amount of free and used physical and swap memory in the
|
library: properly handle memory used by tmpfs
tmpfs has become much more widely used since distributions use it for
/tmp (Fedora 18+). In /proc/meminfo, memory used by tmpfs is accounted
into "Cached" (aka "NR_FILE_PAGES",
http://lxr.free-electrons.com/source/mm/shmem.c#L301 ).
The tools just pass it on, so what top, free and vmstat report as
"cached" is the sum of page cache and tmpfs.
free has the extremely useful "-/+ buffers/cache" output. However, now
that tmpfs is accounted into "cached", those numbers are way off once
you have big files in /tmp.
Fortunately, kernel 2.6.32 introduces "Shmem", which makes tmpfs memory
usage accessible from userspace (
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4b02108ac1b3354a22b0d83c684797692efdc395 ).
This patch substracts Shmem from Cached to get the actual page cache
memory. This makes both issues mentioned above disappear. For older
kernels, Shmem is not available (hence zero) and this patch is no-op.
Additionally:
* Update the man pages of free and vmstat to explain what is happening
* Finally drop "MemShared" from the /proc/meminfo parser, it has been
dead for 10+ years and is only causing confusion ( removed in kernel
2.5.54, see
https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/commit/?id=fe04e9451e5a159247cf9f03c615a4273ac0c571 )
2014-02-19 02:42:21 +05:30
|
|
|
system, as well as the buffers and caches used by the kernel. The
|
|
|
|
information is gathered by parsing /proc/meminfo. The displayed
|
|
|
|
columns are:
|
|
|
|
.TP
|
|
|
|
\fBtotal\fR
|
|
|
|
Total installed memory (MemTotal and SwapTotal in /proc/meminfo)
|
|
|
|
.TP
|
|
|
|
\fBused\fR
|
2014-07-31 20:16:54 +05:30
|
|
|
Used memory (calculated as \fBtotal\fR - \fBfree\fR - \fBbuffers\fR - \fBcache\fR)
|
library: properly handle memory used by tmpfs
tmpfs has become much more widely used since distributions use it for
/tmp (Fedora 18+). In /proc/meminfo, memory used by tmpfs is accounted
into "Cached" (aka "NR_FILE_PAGES",
http://lxr.free-electrons.com/source/mm/shmem.c#L301 ).
The tools just pass it on, so what top, free and vmstat report as
"cached" is the sum of page cache and tmpfs.
free has the extremely useful "-/+ buffers/cache" output. However, now
that tmpfs is accounted into "cached", those numbers are way off once
you have big files in /tmp.
Fortunately, kernel 2.6.32 introduces "Shmem", which makes tmpfs memory
usage accessible from userspace (
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=4b02108ac1b3354a22b0d83c684797692efdc395 ).
This patch substracts Shmem from Cached to get the actual page cache
memory. This makes both issues mentioned above disappear. For older
kernels, Shmem is not available (hence zero) and this patch is no-op.
Additionally:
* Update the man pages of free and vmstat to explain what is happening
* Finally drop "MemShared" from the /proc/meminfo parser, it has been
dead for 10+ years and is only causing confusion ( removed in kernel
2.5.54, see
https://git.kernel.org/cgit/linux/kernel/git/tglx/history.git/commit/?id=fe04e9451e5a159247cf9f03c615a4273ac0c571 )
2014-02-19 02:42:21 +05:30
|
|
|
.TP
|
|
|
|
\fBfree\fR
|
|
|
|
Unused memory (MemFree and SwapFree in /proc/meminfo)
|
|
|
|
.TP
|
|
|
|
\fBshared\fR
|
|
|
|
Memory used (mostly) by tmpfs (Shmem in /proc/meminfo, available on
|
|
|
|
kernels 2.6.32, displayed as zero if not available)
|
|
|
|
.TP
|
|
|
|
\fBbuffers\fR
|
|
|
|
Memory used by kernel buffers (Buffers in /proc/meminfo)
|
|
|
|
.TP
|
2014-07-31 20:16:54 +05:30
|
|
|
\fBcache\fR
|
|
|
|
Memory used by the page cache and slabs (Cached and Slab in /proc/meminfo)
|
|
|
|
.TP
|
|
|
|
\fBbuff/cache\fR
|
|
|
|
Sum of \fBbuffers\fR and \fBcache\fR
|
2014-07-12 02:04:06 +05:30
|
|
|
.TP
|
|
|
|
\fBavailable\fR
|
|
|
|
Estimation of how much memory is available for starting
|
|
|
|
new applications, without swapping. Unlike the data
|
2014-07-31 20:16:54 +05:30
|
|
|
provided by the \fBcache\fR or \fBfree\fR fields,
|
2014-07-12 02:04:06 +05:30
|
|
|
this field takes into account page cache and also that
|
|
|
|
not all reclaimable memory slabs will be reclaimed
|
2014-07-17 20:32:27 +05:30
|
|
|
due to items being in use (MemAvailable in /proc/meminfo, available on
|
2014-07-19 15:14:44 +05:30
|
|
|
kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as \fBfree\fR)
|
2011-09-28 02:34:35 +05:30
|
|
|
.SH OPTIONS
|
2011-02-23 13:47:54 +05:30
|
|
|
.TP
|
2011-09-28 02:34:35 +05:30
|
|
|
\fB\-b\fR, \fB\-\-bytes\fR
|
2011-02-23 13:47:54 +05:30
|
|
|
Display the amount of memory in bytes.
|
|
|
|
.TP
|
2015-04-03 13:48:58 +05:30
|
|
|
\fB\-k\fR, \fB\-\-kibi\fR
|
|
|
|
Display the amount of memory in kibibytes. This is the default.
|
2011-04-18 23:00:21 +05:30
|
|
|
.TP
|
2015-04-03 13:48:58 +05:30
|
|
|
\fB\-m\fR, \fB\-\-mebi\fR
|
|
|
|
Display the amount of memory in mebibytes.
|
2011-02-23 13:47:54 +05:30
|
|
|
.TP
|
2015-04-03 13:48:58 +05:30
|
|
|
\fB\-g\fR, \fB\-\-gibi\fR
|
|
|
|
Display the amount of memory in gibibytes.
|
|
|
|
.TP
|
|
|
|
\fB\-\-tebi\fR
|
|
|
|
Display the amount of memory in tebibytes.
|
|
|
|
.TP
|
|
|
|
\fB\-\-pebi\fR
|
|
|
|
Display the amount of memory in pebibytes.
|
|
|
|
.TP
|
|
|
|
\fB\-\-kilo\fR
|
|
|
|
Display the amount of memory in kilobytes. Implies --si.
|
|
|
|
.TP
|
|
|
|
\fB\-\-mega\fR
|
|
|
|
Display the amount of memory in megabytes. Implies --si.
|
|
|
|
.TP
|
|
|
|
\fB\-\-giga\fR
|
|
|
|
Display the amount of memory in gigabytes. Implies --si.
|
2011-02-23 13:47:54 +05:30
|
|
|
.TP
|
2011-09-28 02:34:35 +05:30
|
|
|
\fB\-\-tera\fR
|
2015-04-03 13:48:58 +05:30
|
|
|
Display the amount of memory in terabytes. Implies --si.
|
|
|
|
.TP
|
|
|
|
\fB\-\-peta\fR
|
|
|
|
Display the amount of memory in petabytes. Implies --si.
|
2011-02-23 13:47:54 +05:30
|
|
|
.TP
|
2011-09-28 02:34:35 +05:30
|
|
|
\fB\-h\fR, \fB\-\-human\fP
|
|
|
|
Show all output fields automatically scaled to shortest three digit unit and
|
|
|
|
display the units of print out. Following units are used.
|
|
|
|
.sp
|
2011-04-18 23:00:21 +05:30
|
|
|
.nf
|
|
|
|
B = bytes
|
2015-04-03 13:48:58 +05:30
|
|
|
K = kibibyte
|
|
|
|
M = mebibyte
|
|
|
|
G = gibibyte
|
|
|
|
T = tebibyte
|
|
|
|
P = pebibyte
|
2011-04-18 23:00:21 +05:30
|
|
|
.fi
|
2011-09-28 02:34:35 +05:30
|
|
|
.sp
|
2015-04-03 13:48:58 +05:30
|
|
|
If unit is missing, and you have exbibyte of RAM or swap, the number is in
|
|
|
|
tebibytes and columns might not be aligned with header.
|
2011-02-23 13:47:54 +05:30
|
|
|
.TP
|
2014-07-31 20:16:54 +05:30
|
|
|
\fB\-w\fR, \fB\-\-wide\fR
|
|
|
|
Switch to the wide mode. The wide mode produces lines longer
|
|
|
|
than 80 characters. In this mode \fBbuffers\fR and \fBcache\fR
|
|
|
|
are reported in two separate columns.
|
2014-07-12 02:04:06 +05:30
|
|
|
.TP
|
2011-09-28 02:34:35 +05:30
|
|
|
\fB\-c\fR, \fB\-\-count\fR \fIcount\fR
|
|
|
|
Display the result
|
|
|
|
.I count
|
|
|
|
times. Requires the
|
|
|
|
.B \-s
|
|
|
|
option.
|
2011-02-23 13:47:54 +05:30
|
|
|
.TP
|
2011-09-28 02:34:35 +05:30
|
|
|
\fB\-l\fR, \fB\-\-lohi\fR
|
2011-04-18 23:00:21 +05:30
|
|
|
Show detailed low and high memory statistics.
|
|
|
|
.TP
|
2011-09-28 02:34:35 +05:30
|
|
|
\fB\-s\fR, \fB\-\-seconds\fR \fIseconds\fR
|
|
|
|
Continuously display the result delay
|
|
|
|
.I seconds
|
|
|
|
apart. You may actually specify any floating point number for
|
|
|
|
.IR delay ,
|
2002-02-02 04:17:29 +05:30
|
|
|
.BR usleep (3)
|
|
|
|
is used for microsecond resolution delay times.
|
2011-02-23 13:47:54 +05:30
|
|
|
.TP
|
2011-09-28 02:34:35 +05:30
|
|
|
\fB\-\-si\fR
|
2015-04-03 13:48:58 +05:30
|
|
|
Use kilo, mega, giga etc (power of 1000) instead of kibi, mebi, gibi (power
|
|
|
|
of 1024).
|
2011-04-18 23:00:21 +05:30
|
|
|
.TP
|
2011-09-28 02:34:35 +05:30
|
|
|
\fB\-t\fR, \fB\-\-total\fR
|
2011-02-23 13:47:54 +05:30
|
|
|
Display a line showing the column totals.
|
|
|
|
.TP
|
2011-09-28 02:34:35 +05:30
|
|
|
\fB\-\-help\fR
|
2011-04-18 23:00:21 +05:30
|
|
|
Print help.
|
|
|
|
.TP
|
2011-09-28 02:34:35 +05:30
|
|
|
\fB\-V\fR, \fB\-\-version\fR
|
2011-02-23 13:47:54 +05:30
|
|
|
Display version information.
|
2011-09-28 02:34:35 +05:30
|
|
|
.PD
|
2002-02-02 04:17:29 +05:30
|
|
|
.SH FILES
|
2011-09-28 02:34:35 +05:30
|
|
|
.TP
|
|
|
|
/proc/meminfo
|
|
|
|
memory information
|
|
|
|
.PD
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR ps (1),
|
|
|
|
.BR slabtop (1),
|
|
|
|
.BR top "(1),
|
|
|
|
.BR vmstat (8).
|
2002-02-02 04:17:29 +05:30
|
|
|
.SH AUTHORS
|
2013-03-11 11:30:00 +05:30
|
|
|
Written by Brian Edmonds.
|
2011-09-28 02:34:35 +05:30
|
|
|
.SH "REPORTING BUGS"
|
|
|
|
Please send bug reports to
|
2012-04-16 16:25:53 +05:30
|
|
|
.UR procps@freelists.org
|
2011-09-28 02:34:35 +05:30
|
|
|
.UE
|