Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

I get different output of file command on same file(checked inode) from different machines.

One of the machines is with suse10 sp3 and the another - rhel4.

machine1>file x.tcl 

x.tcl: ASCII English text

machin2>file x.tcl

x.tcl: data

Even in vi editor same file look different from different machine. Any clue? One more thing - there's third machine suse10 sp3 works fine. Is this machine issue?

share|improve this question

migrated from Jun 28 '11 at 7:27

This question came from our site for professional and enthusiast programmers.

Could it be an utf-8 encoded file in a system without proper unicode support? Hex-edit it and check the first 3 bytes for the BOM. – Paulo Scardine Jun 28 '11 at 7:15
Could u please elaborate. how can i be sure that machine don't have proper unicode support – Coka Jun 28 '11 at 7:18
use md5sum on the file on each machine. – IanNorton Jun 28 '11 at 7:22
Output is machine1> 41928c7bc7701ebc76cf2dd12ccc738d x.tcl machine2> adb69f0a4d662024a559579735d21e15 x.tcl Now how can i interpret from this – Coka Jun 28 '11 at 7:24
If the md5sums are different, then the content is different. The two files are NOT identical. – Dave Sherohman Jun 28 '11 at 9:11

UTF-8 encoded file sometimes have a few bytes in the beginning called BOM (byte order mark). These files may look like binary files in older systems, if the file is pure ASCII English text, just get rid of the BOM.

If the MD5 sum is not the same, then the files are not byte-by-byte identical.

The following oneliner will check the first 3 bytes from x.tcl:

python -c 'print open("x.tcl","rb").read()[:3].__repr__()'
share|improve this answer
ouch, use head -c 3 or od -N 3 instead :-) – Fredrik Pihl Jun 28 '11 at 11:14

Probably the magic files (used by the file command) are different on the two machines.

Try man magic on each one, to see where the magic files are, and compare the entries (they're usually plain text files).

share|improve this answer

Your Answer


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