Linux mit dem Kommando file den Dateityp / mime-type einer Datei erkennen lassen

Thomas Darimont

Erfahrenes Mitglied
Hallo,

mit dem Befehl file kann man den mime-type einer Datei erkennen (schätzen) lassen.
Code:
[tom@localhost tom]$ ll *.jpg
-rw-r--r--    1 tom      tom           338 23. Jan 18:15 field.jpg
[tom@localhost tom]$ file field.jpg
field.jpg: JPEG image data, JFIF standard 1.01, resolution (DPI), 1 x 1
[tom@localhost tom]$ mv field.jpg field
[tom@localhost tom]$ ll field
-rw-r--r--    1 tom      tom           338 23. Jan 18:15 field
[tom@localhost tom]$ file field
field: JPEG image data, JFIF standard 1.01, resolution (DPI), 1 x 1
[tom@localhost tom]$
[tom@localhost tom]$ file -i field
field: image/jpeg

file -i gibt den mime Type aus.

Gruß Tom
 
Zurück