Don't be misled from the file extension name. Get the actual file-type using file command

So, a friend of mine sent me a file with extension .run.gz saying that its a pretty good game. I decided to give it a try and started to extract it, but wait! I got the error saying that it is not a gzip archive. Something was definitely wrong. I was totally confused, thinking "What the hell!!" . The mystery was finally revealed when I ran file command. It stated that the file is a "POSIX shell script text executable". In simple words, I just had to execute the file.

File command doesn't work by looking at the extension, its just for humans. It tries a variety of tests to check the file-type. You can read all about it in the man page. The usage is pretty simple.

[shredde12]$ file fake_file.run.gz
fake_file.run.gz: POSIX shell script text executable

If you have noticed, nautilus only checks for actual file-type if the extension is not mentioned. Otherwise, it just goes with the extension name and displays the appropriate icon.

For those interested, it was not a game just a filthy time-waster. But since I got a tip out of it for you guys, it wasn't all worthless .

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <img> <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockquote> <h1> <h2> <h3> <h4> <h5> <h6> <p> <br>
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • Image links with 'rel="lightbox"' in the <a> tag will appear in a Lightbox when clicked on.

More information about formatting options

Type the characters you see in this picture. (verify using audio)
Type the characters you see in the picture above; if you can't read them, submit the form and a new image will be generated. Not case sensitive.