2

I have some files. All of them were created in different operating systems.

Is there any way to identify from which OS each file was generated?

5
  • Not for all (most) files.
    – martineau
    Sep 19, 2012 at 16:45
  • 1
    Are these simple text files?
    – terdon
    Sep 19, 2012 at 16:47
  • I can generate a Word .doc file on Windows, or Linux (with LibreOffice). It would be impossible in the general sense. I can generate a Windows (line ending) text file on any OS. Sep 19, 2012 at 16:50
  • 1
    What sort of files are they? Providing more details may result in a better answer.
    – Karan
    Sep 19, 2012 at 17:03
  • 2
    What's the original problem? Or, why do you need to do this?
    – Keith
    Sep 19, 2012 at 17:45

2 Answers 2

7

In general, no, not really.

In practice, it may be possible, but it depends on the file and the disk. If it is a text-file, you may be able to identify the OS that created it by the line-breaks:

CR+LF = Windows
LF    = Linux
CR    = Mac

Of course these are only the default line breaks used and there are text editors for each OS that can allow you to manually specify what to use.

If it is a binary file, then there will likely be a file-format that governs the format of its contents, so there is no way to know what OS created it.

You may be able to get a clue as to the originating OS from the disk itself. You could examine the type of the partition, but again it is not a guarantee since most modern OSes support most of the common partition types.

You may also be able to glean some information about the origin of the file via its meta-data (if any).

3
  • CR would be only Mac OS Classic, no? (side note: I've seen LF+CR once in something Novell-related) Sep 19, 2012 at 17:35
  • Maybe it was Cherry Mac. :-D Yes, probably only System* because OSX is Linux based, so I think it uses LF. The lone CR is still called Mac style though since few (if any) other OSes did it that way.
    – Synetech
    Sep 19, 2012 at 17:40
  • *Unix-based (Mach+BSD) Sep 19, 2012 at 17:42
2

Depending on the file type you may actually end up with a sound heuristic (Synetech pointed out one for text files.) However, if you were hoping for some kind of fingerprint inherent to all files an OS generates, (as with tcp/ip implementations) I don't think anything the like exists so far.

Not the answer you're looking for? Browse other questions tagged .