Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

On Linux / Unix Command file:

" -i Causes the file command to output mime type strings rather than the more traditional human readable ones "

Why does it always output "application/octet-stream" for images and videos? How can I obtain the specific mime type of an image or a video with this command or with any other command?


share|improve this question
What is the output without -i ? – Kyle Brandt Nov 20 '09 at 13:50
Without -i the output gives details about the format, for example, "Macromedia Flash Video" – Lucia Nov 20 '09 at 14:08
This may be a better candidate for, BTW – Suppressingfire Nov 20 '09 at 22:24
up vote 0 down vote accepted

Can you tell us what the output is with out the -i switch?

Also, what is the output of the file --version, maybe you are missing magic files?

file --version
magic file from /etc/magic:/usr/share/file/magic

You might just need to update your magic package (I love how these sentances sound :-) ). Do so on debian / ubuntu :

apt-get install libmagic1
share|improve this answer
file someflv.flv: /tmp/phpGo4d1V: Macromedia Flash Video ||| file -i someflev.flv: /tmp/phpGo4d1V: application/octet-stream ||| file --version file-4.17 magic file from /usr/share/file/magic – – Lucia Nov 20 '09 at 14:07
Output of grep flv /usr/share/file/magic ? – Kyle Brandt Nov 20 '09 at 14:24
Or maybe you need: /usr/share/file/magic.mime ? – Kyle Brandt Nov 20 '09 at 14:33
The output is empty then I guess "update" is the correct answer. I will tell my sysadmin about this. Thanks! – Lucia Nov 20 '09 at 14:48

Experienced similar under Ubuntu 9.10 while it was working in Ubuntu 9.04.

Had libmagic1 and libmagic-dev installed with the following:

$ file --version
magic file from /etc/magic:/usr/share/misc/magic

/etc/magic has only a couple comments (in 9.10 and 9.04)
/usr/share/misc/magic is a symlink to ../file/magic

I managed to solve the problem by downgrading file and libmagic. I installed these versions from Jaunty:

  • libmagic1_4.26-2ubuntu3_amd64.deb
  • file_4.26-2ubuntu3_amd64.deb

Things seem to be working now, but I don't know if it'll cause other issues.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.