File extensions aren't useless for Linux distros, they are just a shortcut that is often uneeded. There are a couple of tools that Linux uses which make file extensions largely uneeded. The first, and perhaps the most obvious, is the shebang (
The shebang is a line at the top of scripts executed by a shell to tell the shell what should be used to execute it. For example, the standard line to be included for a bash script is something like this:
This line tells the shell that the scripts contents should be executed by the utility located at
/usr/bin/bash. However, shebangs are really only helpful for executable items.
The next tool used widely by modern applications are MIME types. Mime types are a declaration of file type used widely on the internet so that web browsers and email clients can know what type of file is being transferred. However, many programs rely on these types to know how to handle them (for example, X's
.desktop files may include a mimetype line to declare a file-type association with a particular program).
Finally, a C library and command-line frontend were developed to detect mimetypes through heuristics. These are
file, respectively. Libmagic and
file allow a program, or a user, to detect a file's mimetype even if it is not explicitly declared.
Admittedly, shebangs play a much smaller role in how modern operating systems determine the type of a file, but they are still widely used in the scripting world, and are certainly still a part of the equation.
Some of the declared filetype associations through mimetypes for X can be found in the file
$HOME/.local/share/applications/mimeapps.list (for example).