2002-02-02 06:47:29 +08:00
|
|
|
.\" -*-Nroff-*-
|
|
|
|
.\" This page Copyright (C) 1993 Matt Welsh, mdw@sunsite.unc.edu.
|
2011-04-19 01:30:21 +08:00
|
|
|
.\" Long options where added at April 15th, 2011.
|
2002-02-02 06:47:29 +08:00
|
|
|
.\" Freely distributable under the terms of the GPL
|
2015-04-03 16:18:58 +08:00
|
|
|
.TH FREE 1 "Apr 2015" "procps-ng" "User Commands"
|
2002-02-02 06:47:29 +08:00
|
|
|
.SH NAME
|
|
|
|
free \- Display amount of free and used memory in the system
|
|
|
|
.SH SYNOPSIS
|
2011-02-23 16:17:54 +08:00
|
|
|
.B free
|
2011-09-28 05:04:35 +08:00
|
|
|
.RI [ options ]
|
2002-02-02 06:47:29 +08:00
|
|
|
.SH DESCRIPTION
|
2011-09-28 05:04:35 +08:00
|
|
|
.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 05:12:21 +08:00
|
|
|
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 22:46:54 +08:00
|
|
|
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 05:12:21 +08:00
|
|
|
.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 22:46:54 +08:00
|
|
|
\fBcache\fR
|
2015-10-24 11:29:25 +08:00
|
|
|
Memory used by the page cache and slabs (Cached and SReclaimable in /proc/meminfo)
|
2014-07-31 22:46:54 +08:00
|
|
|
.TP
|
|
|
|
\fBbuff/cache\fR
|
|
|
|
Sum of \fBbuffers\fR and \fBcache\fR
|
2014-07-12 04:34:06 +08:00
|
|
|
.TP
|
|
|
|
\fBavailable\fR
|
|
|
|
Estimation of how much memory is available for starting
|
|
|
|
new applications, without swapping. Unlike the data
|
2014-07-31 22:46:54 +08:00
|
|
|
provided by the \fBcache\fR or \fBfree\fR fields,
|
2014-07-12 04:34:06 +08:00
|
|
|
this field takes into account page cache and also that
|
|
|
|
not all reclaimable memory slabs will be reclaimed
|
2014-07-17 23:02:27 +08:00
|
|
|
due to items being in use (MemAvailable in /proc/meminfo, available on
|
2014-07-19 17:44:44 +08:00
|
|
|
kernels 3.14, emulated on kernels 2.6.27+, otherwise the same as \fBfree\fR)
|
2011-09-28 05:04:35 +08:00
|
|
|
.SH OPTIONS
|
2011-02-23 16:17:54 +08:00
|
|
|
.TP
|
2011-09-28 05:04:35 +08:00
|
|
|
\fB\-b\fR, \fB\-\-bytes\fR
|
2011-02-23 16:17:54 +08:00
|
|
|
Display the amount of memory in bytes.
|
|
|
|
.TP
|
2015-04-03 16:18:58 +08:00
|
|
|
\fB\-k\fR, \fB\-\-kibi\fR
|
|
|
|
Display the amount of memory in kibibytes. This is the default.
|
2011-04-19 01:30:21 +08:00
|
|
|
.TP
|
2015-04-03 16:18:58 +08:00
|
|
|
\fB\-m\fR, \fB\-\-mebi\fR
|
|
|
|
Display the amount of memory in mebibytes.
|
2011-02-23 16:17:54 +08:00
|
|
|
.TP
|
2015-04-03 16:18:58 +08:00
|
|
|
\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 16:17:54 +08:00
|
|
|
.TP
|
2011-09-28 05:04:35 +08:00
|
|
|
\fB\-\-tera\fR
|
2015-04-03 16:18:58 +08:00
|
|
|
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 16:17:54 +08:00
|
|
|
.TP
|
2011-09-28 05:04:35 +08:00
|
|
|
\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-19 01:30:21 +08:00
|
|
|
.nf
|
|
|
|
B = bytes
|
2015-04-03 16:18:58 +08:00
|
|
|
K = kibibyte
|
|
|
|
M = mebibyte
|
|
|
|
G = gibibyte
|
|
|
|
T = tebibyte
|
|
|
|
P = pebibyte
|
2011-04-19 01:30:21 +08:00
|
|
|
.fi
|
2011-09-28 05:04:35 +08:00
|
|
|
.sp
|
2015-04-03 16:18:58 +08:00
|
|
|
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 16:17:54 +08:00
|
|
|
.TP
|
2014-07-31 22:46:54 +08:00
|
|
|
\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 04:34:06 +08:00
|
|
|
.TP
|
2011-09-28 05:04:35 +08:00
|
|
|
\fB\-c\fR, \fB\-\-count\fR \fIcount\fR
|
|
|
|
Display the result
|
|
|
|
.I count
|
|
|
|
times. Requires the
|
|
|
|
.B \-s
|
|
|
|
option.
|
2011-02-23 16:17:54 +08:00
|
|
|
.TP
|
2011-09-28 05:04:35 +08:00
|
|
|
\fB\-l\fR, \fB\-\-lohi\fR
|
2011-04-19 01:30:21 +08:00
|
|
|
Show detailed low and high memory statistics.
|
|
|
|
.TP
|
2011-09-28 05:04:35 +08:00
|
|
|
\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 06:47:29 +08:00
|
|
|
.BR usleep (3)
|
|
|
|
is used for microsecond resolution delay times.
|
2011-02-23 16:17:54 +08:00
|
|
|
.TP
|
2011-09-28 05:04:35 +08:00
|
|
|
\fB\-\-si\fR
|
2015-06-19 21:41:51 +08:00
|
|
|
Use kilo, mega, giga etc (power of 1000) instead of kibi, mebi, gibi (power
|
2015-04-03 16:18:58 +08:00
|
|
|
of 1024).
|
2011-04-19 01:30:21 +08:00
|
|
|
.TP
|
2011-09-28 05:04:35 +08:00
|
|
|
\fB\-t\fR, \fB\-\-total\fR
|
2011-02-23 16:17:54 +08:00
|
|
|
Display a line showing the column totals.
|
|
|
|
.TP
|
2011-09-28 05:04:35 +08:00
|
|
|
\fB\-\-help\fR
|
2011-04-19 01:30:21 +08:00
|
|
|
Print help.
|
|
|
|
.TP
|
2011-09-28 05:04:35 +08:00
|
|
|
\fB\-V\fR, \fB\-\-version\fR
|
2011-02-23 16:17:54 +08:00
|
|
|
Display version information.
|
2011-09-28 05:04:35 +08:00
|
|
|
.PD
|
2002-02-02 06:47:29 +08:00
|
|
|
.SH FILES
|
2011-09-28 05:04:35 +08:00
|
|
|
.TP
|
|
|
|
/proc/meminfo
|
|
|
|
memory information
|
|
|
|
.PD
|
|
|
|
.SH "SEE ALSO"
|
|
|
|
.BR ps (1),
|
|
|
|
.BR slabtop (1),
|
|
|
|
.BR top "(1),
|
|
|
|
.BR vmstat (8).
|
2002-02-02 06:47:29 +08:00
|
|
|
.SH AUTHORS
|
2013-03-11 14:00:00 +08:00
|
|
|
Written by Brian Edmonds.
|
2011-09-28 05:04:35 +08:00
|
|
|
.SH "REPORTING BUGS"
|
|
|
|
Please send bug reports to
|
2012-04-16 18:55:53 +08:00
|
|
|
.UR procps@freelists.org
|
2011-09-28 05:04:35 +08:00
|
|
|
.UE
|