file

फ़ाइल और डायरेक्टरी

इस्तेमाल

file [path]

फ़ाइल का प्रकार नाम से नहीं, सामग्री से पहचानता है; extension को अनदेखा करता है, इसीलिए .jpg जो असल में PDF है, यहाँ पकड़ा जाता है।

आम विकल्प

विकल्पअर्थ
-bPrint only the description, without the file name
--mime-typePrint the MIME type; the short form is -i on GNU, -I on macOS
-LFollow symlinks
-zLook inside compressed files
-sRead block and character devices too
-iOn BSD and macOS this means do not classify contents, not MIME

उदाहरण

file screenshot

Says PNG image data even with no extension.

file -b --mime-type report.pdf

Prints application/pdf and nothing else.

file *

Types every entry in this directory.

हटाना, मिटाना और ढूँढना। कुछ कमांड दोबारा नहीं पूछते, इसीलिए -i लगाने की आदत हाथ बचाती है।

कैसे पढ़ें

  • बड़े कोष्ठक [ ] उस हिस्से को दिखाते हैं जिसे छोड़ा जा सकता है।
  • तीन बिंदु … का मतलब है एक से ज़्यादा दिए जा सकते हैं।
  • विकल्पों में बड़े-छोटे अक्षर मायने रखते हैं — कुछ कमांड में -r और -R अलग काम करते हैं।

आम सवाल

Q. file क्या करता है?

फ़ाइल का प्रकार नाम से नहीं, सामग्री से पहचानता है; extension को अनदेखा करता है, इसीलिए .jpg जो असल में PDF है, यहाँ पकड़ा जाता है।

Q. इसे कैसे लिखें?

file [path] — बड़े कोष्ठक वह हिस्सा दिखाते हैं जो छोड़ा जा सकता है।

Q. कितने विकल्प जानने लायक़ हैं?

यहाँ 6 दिए हैं; पूरी सूची man file में है। यह कमांड फ़ाइल और डायरेक्टरी में आती है।

मिलती-जुलती कमांड

man पेज: man file