Question:
Which of the following Linux commands is/are used to search content from files?
Commands:
i) grep
ii) egrep
iii) fgrep
iv) find
v) tail
vi) tr
निम्नलिखित में से किस लिनक्स कमांड्स का उपयोग फाइलों से कंटेंट सर्च करने के लिए किया जाता है?
कमांड्स:
i) grep
ii) egrep
iii) fgrep
iv) find
v) tail
vi) tr
Options:
- i, ii and iii only
- ii, iii and iv only
- v and vi only
- iv only
- केवल i, ii और iii
- केवल ii, iii और iv
- केवल v और vi
- केवल iv
Correct Answer: a)
Explanation:
Evaluation of the Linux commands:
– **grep** (Global Regular Expression Print): Searches files for lines matching a pattern or regular expression.
– **egrep** (Extended grep): Searches files using extended regular expressions (equivalent to `grep -E`).
– **fgrep** (Fixed grep): Searches files for fixed literal strings without regex interpretation (equivalent to `grep -F`).
– **find**: Searches the filesystem for *files and directories* matching given criteria (name, size, type), not file contents.
– **tail**: Displays the last part of files.
– **tr**: Translates or deletes characters from standard input.
Hence, only **i, ii and iii** are used to search content inside files.
लिनक्स कमांड्स का विश्लेषण:
– **grep**: फ़ाइलों के भीतर टेक्स्ट या रेगुलर एक्सप्रेशन खोजने के लिए।
– **egrep**: एक्सटेंडेड रेगुलर एक्सप्रेशन के साथ फ़ाइल का कंटेंट खोजने के लिए।
– **fgrep**: फिक्स्ड स्ट्रिंग्स को तेजी से खोजने के लिए।
– **find**: डायरेक्टरी में फ़ाइलों/फ़ोल्डरों को उनके नाम, आकार या प्रकार के आधार पर ढूँढने के लिए प्रयुक्त होता है, फ़ाइल के भीतर का कंटेंट नहीं।
– **tail**: फ़ाइल की अंतिम पंक्तियों को दिखाता है।
– **tr**: अक्षरों को अनुवादित (translate) या डिलीट करने के लिए।
अतः फ़ाइलों से कंटेंट सर्च करने के लिए केवल **i, ii और iii** का उपयोग किया जाता है।