Question

1.
2.
3.
4.
Answer (Detailed Solution Below)

Option 2 : grep -r "failed" /var/log --include="*.log" / grep -r "failed" /var/log --include="*.log"

Advertisement

Detailed Solution

सही उत्तर grep -r "failed" /var/log --include="*.log" / grep -r "failed" /var/log --include="*.log" है।

Key Points
Helpful?
PrepSnapprepsnap.in • Part -A

Question:

Which command searches for the word "failed" inside all .log files under /var/log, including subdirectories? / /var/log के अंतर्गत उपनिर्देशिकाओं सहित सभी .log फ़ाइलों में "failed" शब्द खोजने हेतु कौन सी कमांड है?

1.
find /var/log -name "*.log" / find /var/log -name "*.log"
2.
grep -r "failed" /var/log --include="*.log" / grep -r "failed" /var/log --include="*.log"
3.
grep "failed" /var/log / grep "failed" /var/log
4.
locate "failed" /var/log / locate "failed" /var/log

Correct Answer: grep -r "failed" /var/log --include="*.log" / grep -r "failed" /var/log --include="*.log"

The -r flag makes grep descend recursively and --include restricts matches to .log files; without -r only the named directory itself (not a file) would be searched. / -r ध्वज grep को पुनरावर्ती रूप से नीचे ले जाता है और --include मिलानों को .log फ़ाइलों तक सीमित करता है; -r के बिना केवल नामित निर्देशिका (फ़ाइल नहीं) खोजी जाएगी।

Downloaded from PrepSnap (prepsnap.in)