QA
Beginner LevelLinux Commands & SysAdmin

How do which, whereis, and type locate command binaries in PATH?

❓ Interview Prompt: Compare which (locates executable path in $PATH) vs whereis (locates binary, source, and man pages) vs type (identifies shell built-ins vs binaries).

Finding command locations relies on three distinct utilities:

•
'which command': Searches directories listed in '$PATH' and returns the full absolute path of the executable invoked by the shell.
•
'whereis command': Locates executable binary, source code files, and manual man pages.
•
'type command': Reveals whether a command is a shell built-in ('cd', 'alias'), alias, or external disk binary.

Code Implementation Example

bash
# Find absolute path of python3 executable in $PATH
which python3

# Check if 'cd' is a shell built-in or binary
type cd

# Locate binary, source, and manual page for git
whereis git
💡Locating binary paths and inspecting command types using which and type.
🎯 Interview Key Takeaway

Use which to find the active executable path in $PATH, and type to check if a command is a shell built-in.

More Linux Commands & SysAdmin Interview Questions

Beginner LevelLinux Commands & SysAdmin

How do Linux File Permissions (chmod, chown, chgrp) work in Octal and Symbolic notation?

Beginner LevelLinux Commands & SysAdmin

What is the Linux Filesystem Hierarchy Standard (/bin, /etc, /var, /usr, /opt, /tmp)?

Beginner LevelLinux Commands & SysAdmin

What are File Descriptors (0=stdin, 1=stdout, 2=stderr) and Redirection (>, >>, 2>&1)?