Master the Linux whereis Command for Lightning‑Fast File Location
This guide explains how the Linux whereis command quickly locates binaries, source files, and manual pages by querying a system database, details its options, shows practical examples, and warns about the database's weekly update cycle.
Command Syntax
whereis [options] filenamePurpose
whereis locates the executable, source code, and manual (help) files of a given program name. It can also search for unusual items and specify alternative search paths.
How It Works
Unlike find, whereis reads from a pre‑built database that records the locations of all files, making searches extremely fast. The database is refreshed only about once a week, so recent changes may not be reflected.
Options
-b Locate binary (executable) files.
-m Locate manual/help files.
-s Locate source code files.
-u Search for files outside the default binary, source, and help categories.
-B Specify a custom search path for binaries.
-M Specify a custom search path for manual files.
-S Specify a custom search path for source files.
Examples
whereis ls
ls: /usr/bin/ls /usr/share/man/man1/ls.1.gz whereis -b ls
ls: /usr/bin/ls whereis -m lsNote: The last command returns no output if the manual page is not found in the database.
Liangxu Linux
Liangxu, a self‑taught IT professional now working as a Linux development engineer at a Fortune 500 multinational, shares extensive Linux knowledge—fundamentals, applications, tools, plus Git, databases, Raspberry Pi, etc. (Reply “Linux” to receive essential resources.)
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
