101-500 practice question 13 of 30

Which of the following commands can be used to locate programs and their corresponding man pages and configuration files?

Full set: 246 questions
Answer options
A: dirname
B: which
C: basename
D: query
E: whereis Correct answer
Correct Answer:
E. whereis
Explanation

The whereis command is specifically designed to locate the binary, source code, and manual page files for a specified command. It searches through a standard set of Linux directories where these files are typically stored. This makes it a comprehensive tool for finding not just the executable program but also its associated documentation and, if available, its source files.

Why Incorrect

A. dirname extracts the directory portion of a given path, not locate related program files.
B. which only locates the executable file for a command within the directories listed in the $PATH environment variable.
C. basename extracts the non-directory (filename) portion of a given path.
D. query is not a standard Linux command for locating files or programs in this context.

References

- Linux man page for whereis(1). The NAME section states: "whereis - locate the binary, source, and manual page files for a command". The DESCRIPTION section further details the standard search paths.

- Sobell, M. G. (2018). A Practical Guide to Linux Commands, Editors, and Shell Programming. Prentice Hall. Chapter 4, "Finding Commands," details the differences between which, whereis, and locate.

- The Linux Documentation Project (TLDP), "Introduction to Linux - A Hands on Guide," Section 5.5. "Finding files." This section contrasts find, locate, which, and whereis.

Scroll to Top