When it comes to software, there are two types of people: those who like things simple and those who like things complicated. I fall into the latter category. I’m not a big fan of file extensions, and I don’t think they’re necessary in most cases. I know some people who do, though. They say that file extensions make programs more difficult to use and that they make it harder for people to find the files they need. I can see why they might feel that way, but I don’t agree with them. First of all, file extensions aren’t always the only thing that makes a program more difficult to use. In fact, many programs are just plain easier without any file extensions at all. For example, Windows Explorer doesn’t have any file extensions by default, but you can easily add them by editing your registry key. Mac OS X also has a built-in system for adding file extensions (called “Extensions”), so you don’t need to worry about it. Second of all, even if some programs do requirefile extensions, there’s no reason why everyone should have them. In fact, many people findfile extensionless programs easier to use than those with them. For example, Firefox is one of the most popular web browsers on the planet and without anyfile extensionality it would be much harder for someone to get started with web browsing! So in conclusion: File Extensions aren’t necessary in most cases and may even be less helpful than programs without them. If you want something simpler or more efficient then just go for it!
Coming from Windows, file extensions on Linux and Mac OS X can seem a bit strange. The operating system seems to know what files are without relying on the file extension — it does this using MIME types.
MIME types are now known as “Internet Media Types.” MIME types were originally created for email — “MIME” stands for Multipurpose Internet Mail Extensions — but they’ve expanded to other uses.
What is a File, Anyway?
A file is just a set of 1’s and 0’s. The file system associated a file like “Document.pdf” with a chunk of these 1’s and 0’s. A “file type” is simply information associated with a file that tells the operating system and programs how to interpret these 1’s and 0’s. For example, a PNG image needs to be opened with an image viewer that supports PNG files. Open it in a text editor and you’ll see gibberish. Try to run it as a program and it won’t run.
File Extensions on Windows
RELATED: How Hackers Can Disguise Malicious Programs With Fake File Extensions
Windows ignores MIME types, relying only on file extensions. For example, you might have a text file named Example.txt. Windows knows it’s a text file because of the .txt file extension. Remove the .txt. file extension — renaming the file to “Example” with no file extension — and Windows won’t know what to do with the resulting file. This is why Windows warns you when removing the file extension, saying “If you change a file name extension, the file may become unusable.” It won’t become unusable forever — you can make it “usable” again by readding the original file extension.
This is why Windows hides file extensions by default, so people won’t accidentally delete these file extensions. Attackers can abuse this behavior — and other exploits — to disguise files with fake file extensions.
Double-click the file afterward and Windows will display a list of programs you can use to open files. Windows has no idea what type of file this is, but it will open properly if you open it using a text editor. The “file type” is stored in the file name itself. File extensions aren’t special — they’re just a few characters after a period in the file name. You can have a file extension with a single character or even more than three characters.
RELATED: Beginner Geek: 7 Ways You Can Change Default Applications and File Associations in Windows
To configure which applications open files, you have to associate them with different file extensions. Windows attempts to present this in a prettier interface, but you’re still just choosing which application should be associated with which file extension.
MIME Types on Linux or Mac OS X
RELATED: How to Change Your Default Applications on Ubuntu: 4 Ways
When you open a file on Linux or Mac OS X, the operating system doesn’t just rely on the file extension. In fact, if you make a text file on Linux, it will often have no file extension at all by default. If you double-click such a text file, it will open in a text editor. If you have an image file without a file extension, you can double-click it and it will open directly in an image viewer. Other types of files will open in their default applications.
Rather than relying on the file extension at the end of a file’s name, information about the file’s content — the file’s MIME type — is embedded into the beginning of the file itself. So, when you open a file with no file extension, Linux and Mac OS X will look at the file’s MIME type to determine what type of file it is.
Here’s a list of common Windows file extensions and their equivalent MIME types:
If you wanted to change the default text editor on Linux, you’d change the text/plain MIME type association.
.html – text/html
.mp3 – audio/mpeg3
.png – image/png
.doc – application/msword
Linux and Mac Files on Windows
Bring files with no file extensions from Linux to Windows and you may not be able to access them. if you know what type of file each file is, you can just open it directly in the correct program or add the appropriate file extension.
Both Linux and Mac OS X often use file extensions, which help with compatibility. However, they don’t rely only on file extensions. They may use file extensions when MIME type information is unclear — for example, Mac OS X warns you that “your document may open in a different application” if you remove or change a file extension. The file extension may override the MIME type, but the file will still be usable without a file extension thanks its MIME type information.
MIME Type in Your Browser
Your web browser and email client also rely on MIME types. This is how your web browser knows that a page like http://example.com/page should be rendered as an HTML file even if it doesn’t have a file extension like http://example.com/page.html — the web server sends the text/html MIME type along with the file. If the server wants your browser to download the file, it sends the application/octet-stream MIME type. This means “this is a binary file, just download and save it as a file.”
In some cases, a server may have incorrect MIME type settings configured. This is why you’ll sometimes click a link on a web page only to have the next page downloaded to your computer as a file rather than open in your web browser. If the MIME type application/octet-stream is sent when a MIME type like text/html should be sent instead, the file will be downloaded. There’s not much you can do about this beyond waiting for the server to stop misbehaving.
MIME types are fairly simple, although they can seem like black magic to a new Linux or Mac user. They do provide more freedom when it comes to naming your files — you can name documents, pictures, and videos whatever you want on Linux, removing file extensions if you want to.