file: Happy 40th Birthday!

Occasionally you might — or at least I do, from time to time — come across a file with no clear indication what it is or where it’s supposed to go.

The file tool is helpful a times like that. file attempts to figure out what mystery files are, by skimming through a series of tests and giving the first result that works.

2013-11-09-lv-r1fz6-file

As you can see in the example, my hnb notes file comes out as an XML text file, which is 100 percent correct. I can also ask for a mime type, which you see there.

file tries to match archives too, but also can dig through archives and check the contents. That might be a particularly useful tweak sometimes.

I see in the man pages that file can also look at drive partitions and tell you what the contents are. This might seem an odd chore for file, but remember, everything is a file.

So if you have a mystery partition on a drive and you’re not sure if it’s a leftover Windows installation or someone’s secret data stash, file might be able to give you a hint.

Other than that, and the fact that (according to the man page) the file tool in some form or another dates back November 1973, I can’t think of much else to say. Except maybe … Happy Birthday!

Advertisements

2 thoughts on “file: Happy 40th Birthday!

  1. Curtis

    I follow the linux-btrfs mailing list, and there was a change in the default leafsize created by mkfs.btrfs. A user asked if there was a way to find out how to determine the leafsize of an already created btrfs filesystem, and the only answer that came up was to use ‘file -s /dev/sdXY’. But you can’t use just any version of file. You have to use the debian patched version that allows file to dig up and show that information (along with a few other neat things).

    For those interested, here is the patch [0]. Maybe it will be merged upstream, as I think it is incredibly useful.
    [0] http://www.spinics.net/lists/linux-btrfs/msg29035.html

  2. Pingback: histo: The shape of things to come | Inconsolation

Comments are closed.