LinuxCommandLibrary

fincore

Determine file pages resident in memory

TLDR

Display cache details for a file

$ fincore [path/to/file]
copy

Display all possible data columns
$ fincore --output-all [path/to/file]
copy

Display help
$ fincore [[-h|--help]]
copy

SYNOPSIS

fincore [options] file...

PARAMETERS

-b, --bytes
    Reports resident portion in bytes. This is the default unit.

-p, --pages
    Reports resident portion in pages.

-P, --percentage
    Reports resident portion as a percentage of the total file size.

-s, --summarize
    Summarizes the resident information for multiple files, displaying a single total for all specified files.

-h, --help
    Displays a help message and exits.

-V, --version
    Displays version information and exits.

DESCRIPTION

fincore is a command-line utility used to report the portion of a given file that is currently resident in RAM (in-core). It leverages the
mincore(2)
system call to determine which pages of a file are present in the system's page cache. This information is crucial for understanding how effectively a file is being cached, which can impact disk I/O performance.

The command displays the file's path, the number of resident pages, the total resident bytes, and the percentage of the file that is in memory. By default, it reports in bytes, but can also show pages or percentages. This tool is particularly useful for administrators and developers to diagnose caching issues, verify memory usage patterns, or ensure critical files are properly cached by the kernel.

CAVEATS

The reported residency is a snapshot at the time of execution and can change rapidly due to system activity.
fincore reports on pages currently held in the kernel's page cache, not necessarily the entire file if it were mapped into a process's address space using
mmap().
The accuracy relies on the underlying
mincore(2) system call.

EXIT STATUS

fincore exits with status 0 on success, and a non-zero status code on error. Errors typically include issues with file access (e.g., file not found or permission denied) or invalid options.

FILES

No specific configuration files are used by fincore. It directly interacts with the kernel's memory management via system calls.

HISTORY

fincore is part of the
util-linux project, a collection of essential system utilities for Linux. It was introduced to provide a user-friendly interface to the
mincore(2) system call, simplifying the process of querying a file's memory residency without requiring custom programming or complex system calls. Its development aligns with the project's goal of offering robust and standardized tools for system administration and monitoring.

SEE ALSO

free(1), vmstat(8), mincore(2), mmap(2)

Copied to clipboard