nerdexam
Linux_Foundation

LFCS · Question #870

Which of the following commands can be used to search for the executable file foo when it has been placed in a directory not included in $PATH?

The correct answer is C. find. The find command can be used to recursively search for files, including executables, in specified directories, irrespective of the $PATH environment variable.

Submitted by valeria.br· Apr 18, 2026Essential Commands

Question

Which of the following commands can be used to search for the executable file foo when it has been placed in a directory not included in $PATH?

Options

  • Aapropos
  • Bwhich
  • Cfind
  • Dquery
  • Ewhereis

How the community answered

(36 responses)
  • B
    3% (1)
  • C
    89% (32)
  • D
    3% (1)
  • E
    6% (2)

Why each option

The `find` command can be used to recursively search for files, including executables, in specified directories, irrespective of the `$PATH` environment variable.

Aapropos

`apropos` searches the man page database for keywords, not the filesystem for executable files.

Bwhich

`which` specifically searches for executable commands only within the directories listed in the user's `$PATH` environment variable.

CfindCorrect

The `find` command is capable of recursively searching specified directories for files based on various criteria, such as name, type, and permissions, making it ideal for locating an executable file not present in the system's `$PATH`.

Dquery

`query` is not a standard Linux command for searching for files on the filesystem.

Ewhereis

`whereis` locates source, binary, and man page files for a command, primarily by searching standard system locations, not arbitrary directories outside `$PATH`.

Concept tested: File searching utilities

Source: https://man7.org/linux/man-pages/man1/find.1.html

Topics

#File search#`find` command#Filesystem navigation#Executable files

Community Discussion

No community discussion yet for this question.

Full LFCS Practice