fincore
Determine file pages resident in memory
TLDR
Display cache details for a file
Display all possible data columns
Display help
SYNOPSIS
fincore [-h] [-L] [-n] [-l] [-r] [-s] [-v] [-V] [-w file] [-x] [-C dir] [-I nr] [-O nr] file...
PARAMETERS
-h, --help
Display help text and exit.
-L, --logical-pages
Use logical page size (default 256 KiB or RLIMIT_DATA limit).
-n, --no-dereference
Do not follow symbolic links.
-l, --list-pages
List individual page numbers as hexadecimal.
-r, --radix16
Print page numbers in hexadecimal format.
-s, --summarize
Print only summary information.
-v, --verbose
Enable verbose output mode.
-V, --version
Display version information and exit.
-w, --writeout=file
Write summary data to specified file.
-x, --pages
Print page numbers in hexadecimal (alternative to -r).
-C, --directory=dir
Process all files in the given directory.
-I, --pages-in=nr
Start processing from page number nr.
-O, --pages-out=nr
Stop processing after page number nr.
DESCRIPTION
fincore is a utility from the util-linux package that queries the kernel to determine which pages of specified files are currently cached in physical memory (RAM). It leverages the mincore(2) system call, which examines the residency of memory pages for a given file range.
By default, for each input file, fincore outputs three values: the total number of pages in the file, the number of pages present in core (RAM), and the percentage of pages cached. A summary line aggregates data across multiple files. This tool is invaluable for performance analysis, such as verifying database file caching efficiency, tuning filesystem buffers, or diagnosing memory usage in applications with heavy I/O.
Options allow customization: verbose listings of cached pages, hexadecimal output, summaries only, or processing entire directories. Note that fincore temporarily maps file regions into memory to perform checks, which may increase memory pressure for very large files.
CAVEATS
Temporarily maps file regions into memory, potentially consuming significant RAM for large files. Requires read permissions on files. Results reflect instantaneous state and may change due to system activity.
EXAMPLE USAGE
fincore -s /var/log/messages
Prints summary: total pages, cached pages, percentage.
fincore -lv /etc/passwd
Verbose list of cached pages in hex.
OUTPUT FORMAT
Default: <total pages> <pages in core> (<percentage>%)
Summary adds totals across files.
HISTORY
Introduced in util-linux version 2.13 (2007) to provide user-space access to mincore(2) functionality. Enhanced in later releases with directory scanning (-C), page range limits (-I/-O), and logical page support.


