ExamGecko
Question list
Search
Search

List of questions

Search

Related questions











Question 182 - XK0-005 discussion

Report
Export

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?

A.
find . -type f -print | xrags grep -ln denied
Answers
A.
find . -type f -print | xrags grep -ln denied
B.
find . -type f -print | xrags grep -nv denied
Answers
B.
find . -type f -print | xrags grep -nv denied
C.
find . -type f -print | xrags grep -wL denied
Answers
C.
find . -type f -print | xrags grep -wL denied
D.
find . -type f -print | xrags grep -li denied
Answers
D.
find . -type f -print | xrags grep -li denied
Suggested answer: D

Explanation:

The command find . -type f -print | xargs grep -li denied will accomplish the task of identifying files that contain any occurrence of the word denied. The find command is a tool for searching for files and directories on Linux systems. The . is the starting point of the search, which means the current directory. The -type f option specifies the type of the file, which means regular file. The -print option prints the full file name on the standard output. The | is a pipe symbol that redirects the output of one command to the input of another command. The xargs command is a tool for building and executing commands from standard input. The grep command is a tool for searching for patterns in files or input. The -li option specifies the flags that the grep command should apply. The -l flag shows only the file names that match the pattern, instead of the matching lines. The -i flag ignores the case of the pattern, which means it matches both uppercase and lowercase letters. The denied is the pattern that the grep command should search for. The command find . -type f -print | xargs grep -li denied will find all the regular files in the current directory and its subdirectories, and then search for any occurrence of the word denied in those files, ignoring the case, and print only the file names that match the pattern. This will allow the administrator to identify files that contain any occurrence of the word denied. This is the correct command to use to accomplish the task. The other options are incorrect because they either do not ignore the case of the pattern (find . -type f -print | xargs grep -ln denied or find . -type f -print | xargs grep -wL denied) or do not show the file names that match the pattern (find . -type f -print | xargs grep -nv denied). Reference: CompTIA Linux+ (XK0-005) Certification Study Guide, Chapter 16: Managing Logging and Monitoring, page 489.

asked 02/10/2024
Preetham Pakhala
29 questions
User
Your answer:
0 comments
Sorted by

Leave a comment first