← 返回命令列表

Linux command

vmtouch 命令

文件

复制后可按需替换文件名、目录或参数。

常用示例

Show file cache status

vmtouch [file]

Load file into cache

vmtouch -t [file]

Evict from cache

vmtouch -e [file]

Lock in memory

vmtouch -l [file]

Verbose output

vmtouch -v [file]

Check directory

vmtouch [directory/]

说明

vmtouch is a tool for inspecting and manipulating the file system page cache on Linux. It can report which pages of a file or directory are currently resident in memory, providing visibility into what the operating system has cached for fast access. Beyond inspection, vmtouch can actively manage the cache by touching files to load them into memory, evicting files to free cached pages, or locking files into RAM to prevent the kernel from swapping them out. This makes it useful for warming caches before high-traffic events, ensuring critical data stays in memory, or clearing cached data for benchmarking purposes. The tool works on individual files or entire directory trees and displays per-file cache residency statistics in verbose mode. Locking pages into memory requires root privileges and is subject to system memory limits.

参数

-t
Touch (load to cache).
-e
Evict from cache.
-l
Lock in memory.
-v
Verbose.
-q
Quiet mode.
-m _SIZE_
Max memory.

FAQ

What is the vmtouch command used for?

vmtouch is a tool for inspecting and manipulating the file system page cache on Linux. It can report which pages of a file or directory are currently resident in memory, providing visibility into what the operating system has cached for fast access. Beyond inspection, vmtouch can actively manage the cache by touching files to load them into memory, evicting files to free cached pages, or locking files into RAM to prevent the kernel from swapping them out. This makes it useful for warming caches before high-traffic events, ensuring critical data stays in memory, or clearing cached data for benchmarking purposes. The tool works on individual files or entire directory trees and displays per-file cache residency statistics in verbose mode. Locking pages into memory requires root privileges and is subject to system memory limits.

How do I run a basic vmtouch example?

Run `vmtouch [file]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does -t do in vmtouch?

Touch (load to cache).