file -bi command line return empty

Installing, Configuring, Troubleshooting server daemons such as Web and Mail
Post Reply
woeful
Posts: 5
Joined: 2013/11/04 13:26:03

file -bi command line return empty

Post by woeful » 2013/11/04 13:32:08

Hello

i want to get file mime type with following command line in a VPS

# file -bi <FILE_LOCATION>

but this command return empty for application/octet-stream mime type .

that command return correct answer in ubuntu but in centos not.

how can i fix it?

thanks

User avatar
avij
Retired Moderator
Posts: 3039
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: file -bi command line return empty

Post by avij » 2013/11/04 13:49:33

Works fine here.

CentOS 5:

Code: Select all

$ dd if=/dev/urandom of=testmime bs=1024 count=1024
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.166885 seconds, 6.3 MB/s
$ file -bi testmime
application/octet-stream
$ file -v
file-4.17
magic file from /usr/share/file/magic
CentOS 6:

Code: Select all

$ dd if=/dev/urandom of=testmime bs=1024 count=1024
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.159065 s, 6.6 MB/s
$ file -bi testmime
application/octet-stream; charset=binary
$ file -v
file-5.04
magic file from /etc/magic:/usr/share/misc/magic

woeful
Posts: 5
Joined: 2013/11/04 13:26:03

Re: file -bi command line return empty

Post by woeful » 2013/11/05 09:37:50

Hello
thanks for your replay.

See this is my output on VPS :

Code: Select all

[root@ser ~]# dd if=/dev/urandom of=testmime bs=1024 count=1024
1024+0 records in
1024+0 records out
1048576 bytes (1.0 MB) copied, 0.152582 seconds, 6.9 MB/s
[root@ser ~]# file -bi testmime
application/octet-stream
[root@ser ~]# file -bi /home/phoenix/Fa.mp4 

[root@ser ~]#
Last command return empty!!!. That command return application/octet-stream on ubuntu!
I don't no why this command for some MP4 file that has this mime type return empty.
For other mp4 file that has another mime type this command work fine.!!

Probably there is a problem.

User avatar
avij
Retired Moderator
Posts: 3039
Joined: 2010/12/01 19:25:52
Location: Helsinki, Finland
Contact:

Re: file -bi command line return empty

Post by avij » 2013/11/05 16:30:51

"application/octet-stream" means the file is just binary data without any recognisable structure. If Ubuntu detects your mp4 files as application/octet-stream instead of the proper video/mp4 MIME type, it isn't really doing the job any better than CentOS. Without having access to your misdetected mp4 files, I can't say what's causing them to not get detected properly.

Post Reply

Return to “CentOS 5 - Server Support”