Linux Terminal Command: whereis
The whereis command is an essential tool in Foundations & Navigation. In this tutorial, we will explore what whereis does, look at everyday examples, and cover advanced options to supercharge your command-line workflow.
Concept & Explanation
The whereis command searches a list of standard system directories for the binary executables, source files, and man pages associated with a specified program.
Common Options & Syntax
whereis [options] [arguments]
Here are the most common flags used with whereis:
- Simple Usage: Basic default commands.
- Detailed View: Shows diagnostic information.
- Advanced Actions: Can chain parameters for scripting.
1. Interactive Example (Simple)
Here is how most people run the command:
# Example
whereis bash
What it does: Prints the binary path, source path, and man page locations for ‘bash’.
2. Power-User Example (Advanced)
For scripting and advanced diagnostics, use this configuration:
# Advanced
whereis -b -m ls
What it does: Limits the search to only show binaries (-b) and manual pages (-m) for the ls command.
⚙️ Warning & Common Pitfalls
[!WARNING]
whereishardcodes standard system search paths (like/usr/bin,/usr/share/man). It will not find binaries placed in custom user directories.
🔗 Related Commands
Here are some related posts on cli_tty1 you might want to check out:
- find : Search for files in a directory hierarchy.