Question:
Which of the following commands is/are used to create files in Linux?
Commands:
i) touch
ii) cat
iii) head
iv) finger
लिनक्स (Linux) में फ़ाइल्स बनाने के लिए निम्न में से किन कमांड्स का उपयोग किया जाता है?
कमांड्स:
i) टच (touch)
ii) कैट (cat)
iii) हेड (head)
iv) फिंगर (finger)
Options:
- i, ii and iii only
- ii, iii and iv only
- i and ii only
- i only
- केवल i, ii और iii
- केवल ii, iii और iv
- केवल i और ii
- केवल i
Correct Answer: c)
Explanation:
In Linux/Unix systems:
– touch (i): Used to create a new, empty file if it does not already exist (e.g., touch myfile.txt), or update timestamps if it does.
– cat (ii): Used with the output redirection operator (cat > myfile.txt) to create a new file and write text into it from the terminal.
– head (iii): Used to output the beginning lines (default first 10 lines) of existing files; it cannot create files.
– finger (iv): A user information lookup program that displays login details of system users; it does not create files.
Therefore, only touch and cat (i and ii) can be used to create files. The correct option is c).
लिनक्स/यूनिक्स में फ़ाइल निर्माण कमांड्स:
– touch (i): यदि फ़ाइल मौजूद नहीं है, तो यह नई खाली फ़ाइल बनाती है (जैसे: touch filename)।
– cat (ii): रीडायरेक्शन ऑपरेटर (जैसे: cat > filename) के साथ इसका उपयोग नई फ़ाइल बनाकर उसमें टेक्स्ट लिखने के लिए किया जाता है।
– head (iii): किसी मौजूदा फ़ाइल की शुरुआती 10 पंक्तियों को प्रदर्शित करता है, इससे फ़ाइल नहीं बनती।
– finger (iv): सिस्टम उपयोगकर्ताओं की जानकारी देखने की कमांड है।
अतः फ़ाइल बनाने के लिए केवल touch और cat (i और ii) का उपयोग किया जाता है। सही उत्तर विकल्प c) है।