Courseiva
Essential Tools →easyMultiple Choice

EX200 Essential Tools Practice Question

A user needs to find all files with the '.conf' extension under /etc. Which command should be used?

⚠ Common exam trap

Many exam-takers confuse `grep` (for content search) with `find` (for file search), or assume `ls` with a glob is sufficient, overlooking the need for recursion across subdirectories.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

find /etc -name "*.conf"

The `find` command is designed to search for files and directories based on criteria such as name, type, or size. Using `find /etc -name "*.conf"` recursively searches the entire `/etc` directory tree for files ending in `.conf`, which is the standard and most reliable method for this task.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✗

    grep -r "*.conf" /etc

    Why it's wrong here

    grep -r "*.conf" /etc is incorrect because grep searches the contents of files for matching text, not for filenames. The -r flag only makes grep recursively search through every file under /etc, but the quoted "*.conf" is treated as a literal string to look for inside file data, not as a shell glob or a filename pattern. Therefore, unless a file's contents literally contain the characters `*.conf`, this command will not return any .conf files, and it will never report files based on their name.

  • ✗

    locate /etc/*.conf

    Why it's wrong here

    locate /etc/*.conf fails because the glob `/etc/*.conf` is expanded by the shell before locate even executes, so locate receives a list of already-existing paths rather than a search pattern. More importantly, locate relies on a prebuilt database generated by updatedb, which is typically run only periodically, meaning newly created .conf files will be missing. Additionally, locate does not check whether the files still exist when it reports them, so the results may be stale and inaccurate.

  • ✗

    ls /etc/*.conf

    Why it's wrong here

    ls /etc/*.conf only lists files that reside directly in the /etc directory because the shell expands `/etc/*.conf` to match entries in that single directory; it does not traverse subdirectories. The command is merely listing the content of the current directory after the expansion, not performing a search or recursion. Even if you added -R, ls is designed to list directory entries, not to locate files across a tree, and it would not give you a clean, recursive list of matching names with the same clarity as find.

  • ✓

    find /etc -name "*.conf"

    Why this is correct

    find /etc -name "*.conf" is the correct choice because find recursively descends into all subdirectories of /etc, applying the -name test to every file and directory it encounters. The -name test compares the filename (basename) against the glob pattern "*.conf" using standard glob matching, and the double quotes ensure the shell passes the pattern to find rather than expanding it to existing filenames. This command outputs the full path of every file under /etc whose name ends in .conf, making it the proper tool for this name-based recursive search.

About these practice questions

This EX200 question is part of Courseiva's 427-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This EX200 practice question is part of Courseiva's free Red Hat certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the EX200 exam.