Bird
0
0

What is the primary difference between the which and whereis commands in Linux?

easy📝 Conceptual Q1 of 15
Linux CLI - Searching and Finding
What is the primary difference between the which and whereis commands in Linux?
A<code>which</code> shows the path of the executable, <code>whereis</code> shows binary, source, and man pages
B<code>which</code> lists all files related to a command, <code>whereis</code> shows only the executable
C<code>which</code> searches the entire system, <code>whereis</code> searches only the current directory
D<code>which</code> shows the source code location, <code>whereis</code> shows the executable path
Step-by-Step Solution
Solution:
  1. Step 1: Understand which command behavior

    which locates the executable file in the user's PATH environment.
  2. Step 2: Understand whereis command behavior

    whereis locates the binary, source, and manual files for a command.
  3. Final Answer:

    which shows the path of the executable, whereis shows binary, source, and man pages -> Option A
  4. Quick Check:

    Difference between which and whereis = A [OK]
Quick Trick: Use which for executables, whereis for more info [OK]
Common Mistakes:
  • Confusing which with whereis output
  • Assuming which shows source files
  • Thinking whereis searches only PATH

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Linux CLI Quizzes