nerdexam
CompTIACompTIA

XK0-005 · Question #1412

XK0-005 Question #1412: Real Exam Question with Answer & Explanation

The correct answer is D: find . -type f -print | xrags grep -li denied. {"question_number": 1, "correct_answer": "D", "explanation": "The command find . -type f -print | xargs grep -li denied is correct. The -l flag tells grep to list only the filenames (not the matching lines) that contain a match, and the -i flag makes the search case-insensitive -

Troubleshooting

Question

A Linux administrator reviews a set of log output files and needs to identify files that contain any occurrence of the word denied. All log files containing entries in uppercase or lowercase letters should be included in the list. Which of the following commands should the administrator use to accomplish this task?

Options

  • Afind . -type f -print | xrags grep -ln denied
  • Bfind . -type f -print | xrags grep -nv denied
  • Cfind . -type f -print | xrags grep -wL denied
  • Dfind . -type f -print | xrags grep -li denied

Explanation

{"question_number": 1, "correct_answer": "D", "explanation": "The command find . -type f -print | xargs grep -li denied is correct. The -l flag tells grep to list only the filenames (not the matching lines) that contain a match, and the -i flag makes the search case-insensitive - so it matches 'denied', 'Denied', 'DENIED', etc. Together, -li returns a list of files containing any case variant of the word. Option A (-ln) shows line numbers instead of just filenames. Option B (-nv) inverts the match and shows lines that do NOT contain the word. Option C (-wL) uses whole-word matching and lists files that do NOT contain the word (-L is the inverse of -l).", "generated_by": "claude-sonnet", "llm_judge_score": 4}

Topics

#grep#find#xargs#Log Analysis

Community Discussion

No community discussion yet for this question.

Full XK0-005 PracticeBrowse All XK0-005 Questions