Exam LFCS All QuestionsBrowse all questions from this exam
Question 91

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?

    Correct Answer: C

    The find command can be used to search for the executable file foo when it has been placed in a directory not included in $PATH. This command allows you to search the entire file system or a specific directory based on various criteria such as name, type, and location. By specifying the starting directory and the name of the file, find can locate the executable file regardless of the $PATH environment variable.

Discussion
StribOption: C

The correct answer is C. The find command can be used to search for the executable file foo when it has been placed in a directory not included in $PATH. The find command is a versatile tool for searching files and directories based on various criteria, such as name, type, size, or location. In this case, you can use find to search for the foo executable file by specifying the starting directory where you want to begin the search. This command searches from the root directory ("/") and looks for a file named "foo" that is executable. It will search the entire file system to find the file, even if the directory it is located in is not included in the $PATH environment variable.

Strib

The other options are not specifically designed for searching executable files: A. apropos is used to search the manual page database for commands or topics. B. which is used to locate the executable file of a command within directories listed in $PATH. D. query is not a standard command in most Linux distributions. E. whereis is used to locate the binary, source, and manual page files for a command, but it relies on the directories specified in $PATH. Therefore, the correct answer is C. Use the find command to search for the executable file foo in a directory not included in $PATH.