Linux/Unix: Command Lookup Tools β type, which, whatis, apropos Explained
Introduction β Why Learn Linux Command Lookup Tools?
Linux offers multiple tools to identify commands, their locations, usage, and related utilities. Whether youβre a beginner checking where a command resides or a pro searching for forgotten commands, tools like type, which, whatis, and apropos make command-line navigation faster and smarter.
In this guide, youβll learn:
- How to find the type or path of a command
- How to get a one-line summary of any command
- How to discover related commands by keyword
- Real-world use cases with output examples
1. type β Identify the Nature of a Command
What is type?
type tells you how a command is interpreted by the shellβwhether it’s a built-in, alias, function, or executable.
Syntax:
type command
Examples:
type ls
Output:
ls is aliased to `ls --color=auto`
type cd
Output:
cd is a shell builtin
Great for debugging behavior when commands act differently than expected.
2. which β Locate Executable Path
What is which?
which shows the full path to an executable command in the user’s $PATH.
Syntax:
which command
Examples:
which python3
Output:
/usr/bin/python3
which ifconfig
Output (if installed):
/sbin/ifconfig
Ideal for checking if a command is installed and which version is being used.
3. whatis β Get One-Line Description of a Command
What is whatis?
whatis fetches a brief one-line summary from the manual database.
If database is missing, update it:
sudo mandb
Syntax:
whatis command
Example:
whatis grep
Output:
grep (1) - print lines that match patterns
Perfect for quick lookups when you forget what a command does.
4. apropos β Search for Commands by Keyword
What is apropos?
apropos searches manual page descriptions for any given keyword. Itβs like man -k.
Syntax:
apropos keyword
Examples:
apropos network
Sample Output:
netstat (8) - Print network connections, routing tables...
ifconfig (8) - configure a network interface
ping (8) - send ICMP ECHO_REQUEST to network hosts
Great for discovering new tools or when you don’t remember the exact command name.
Tool Comparison Table
| Command | Purpose | Output Type | Ideal For |
|---|---|---|---|
type | Show if command is built-in, alias, etc | Text explanation | Shell behavior debugging |
which | Locate command binary path | File path | Finding executable location |
whatis | Show one-line manual summary | Description | Quick info lookup |
apropos | Search man pages by keyword | List of matches | Discovering related commands |
Summary β Recap & Next Steps
Command lookup tools help you understand, locate, and learn Linux commands efficiently. From checking command types to exploring related tools, these are your best friends when navigating the terminal.
Key Takeaways:
- Use
typeto see if a command is built-in, alias, or external. - Use
whichto locate the path of executables. - Use
whatisto get short command summaries. - Use
aproposto explore related commands by topic.
FAQs
Why does which not show aliases?
which only checks for executable files, not aliases or shell built-ins. Use type instead for full classification.
Can I search for man pages that match a keyword?
Yes, use apropos keyword or man -k keyword.
What if whatis and apropos return nothing?
Your manual database may be outdated. Update it with:
sudo mandb
Is there a way to list all aliases?
Yes:
alias
How can I see the path of a shell built-in like cd?
You canβtβit has no path. Use:
type cd
Share Now :
