File extensions — hints, not rules
Look at a filename:
vacation.jpg
The part after the last dot — jpg — is called the extension. It’s a short tag that
suggests what kind of stuff is inside the file.
A few you’ll see constantly:
| Extension | Usually means |
|---|---|
.txt | Plain text |
.jpg, .png | A photo or image |
.mp3, .wav | Audio |
.mp4, .mov | Video |
.pdf | A document you read but don’t edit |
.docx | A Word document |
.zip | A folder squashed into one file |
They’re hints, not rules
Here’s where most people are quietly wrong about extensions: they don’t make a file what it is. They just describe what it is.
Try this thought experiment. Take a song file called song.mp3 and rename it to song.txt.
- The bytes inside the file didn’t change. The music is still there.
- Double-click it and your computer will probably try to open it in a text editor, because you told it the file was text.
- The text editor will show you a screenful of garbage, because the bytes are an mp3, not text.
You lied to the computer about what was inside. It believed you. Nothing else changed.
This is why “just change the extension” is almost never how you actually convert a file. To
turn a .png into a .jpg, you need an app that reads the PNG bytes and writes JPG bytes.
Renaming alone is a lie.
So what is the extension for?
Two jobs, both useful:
- A signal to humans. You see
resume.pdfand know not to open it in Photoshop. - A default for “what app opens this?” Your OS uses the extension to pick a default app when you double-click. Change the extension and the OS picks a different app.
On Mac and Linux, the system can also peek inside the file’s first few bytes to guess the real type (this is called a “magic number” check). That’s why some files open correctly even when the extension is wrong or missing.
Hidden extensions
By default, Mac’s Finder and Windows’ File Explorer hide most extensions. You see
vacation but the real filename is vacation.jpg. This is one of the most confusing defaults
in computing — a million people have wondered why their report and report were different
files (one was report.pdf, the other report.docx).
In a terminal, extensions are never hidden. What you see is what’s there. Some people call that the first relief of switching from a file manager to a terminal.
What’s next
You’ve got files, folders, apps, processes, paths, and extensions. One last orientation question: where on your computer does all this live? That’s the next lesson.