Frequently Asked Question

Do file extensions matter in Linux?

At the filesystem and kernel level, no, Linux does not care. photo.jpg and photo are equally valid names; nothing in the kernel reads the part after the dot. The file command identifies content by sniffing magic numbers at the start of each file (a PNG always begins with 89 50 4E 47), and most programs that need to know a file's type do the same. This is fundamentally different from Windows, where the shell uses the extension to decide which application opens a double-clicked file.

In practice you should still use sensible extensions. Desktop file managers consult the extension for icons and default applications, build tools like make look at .c versus .h, and a script saved as backup is much harder to find six months later than backup.sh. The right way to think about it is that extensions are a hint for humans and user-space tooling, not a contract enforced by the operating system.

Video

Further reading and video