✍️ Linux/Unix: Editors & Help Tools
Estimated reading: 3 minutes 33 views

🧭 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

CommandPurposeOutput TypeIdeal For
typeShow if command is built-in, alias, etcText explanationShell behavior debugging
whichLocate command binary pathFile pathFinding executable location
whatisShow one-line manual summaryDescriptionQuick info lookup
aproposSearch man pages by keywordList of matchesDiscovering 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 type to see if a command is built-in, alias, or external.
  • Use which to locate the path of executables.
  • Use whatis to get short command summaries.
  • Use apropos to 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 :

Leave a Reply

Your email address will not be published. Required fields are marked *

Share

πŸ”΅ Linux/Unix: Command Lookup (type, which, whatis, apropos)

Or Copy Link

CONTENTS
Scroll to Top