Preliminaries

ProgrammingEverything is editing files.

The work

Different apps, same job: open a file, change it, save it.

xkcd comic 'Real Programmers': programmers one-up each other on how they edit files: nano, emacs, vim, ed, cat, a magnetized needle and a steady hand, and finally butterflies. Emacs has a command for that.
Programmers have argued about the best way to edit files for decades. xkcd 378 · Real Programmers, by Randall Munroe (CC BY-NC 2.5)

The agents

Your part

Many paths

Terminalmv notes.txt docs/
or
Finder / File Explorerdrag notes.txt into docs

First things first

What a file is

Before terminals, code or AI, there is one idea underneath everything on a computer: the file. Get this right and the rest of the path is just new ways of handling files.

Everything is a file. Everything.

  • That photo on your phone? A file.
  • The song in your headphones, the movie you're streaming? Files.
  • Chrome, Word, every app you've ever opened? A folder of files.
  • A website? Files on someone else's computer, sent to yours.
  • ChatGPT, Claude, Gemini? Underneath, the model is a giant file of numbers.
  • Your settings, your password manager, your saved game? Files.
  • On Mac and Linux, even your keyboard, your screen and the programs running right now show up as files.
  • And when an AI agent writes code for you, what is it doing? Editing files.

Understand files and the whole computer stops being a black box.

A file is a name plus some bytes

A byte is a small number from 0 to 255. Every file on your computer, whether it's a photo, a song, a spreadsheet or a program, is just a list of bytes with a name attached. That's all.

The letters you are reading are bytes too. Your computer agrees on a code (it's called UTF-8) where h is 104, i is 105, and a line break is 10. Type something below and watch it turn into the bytes that would sit inside a .txt file.

Try it · text into bytes

Try an accent like é or an emoji like 🙂: some characters need more than one byte (shaded green).

A photo is the same thing with different rules: its bytes describe colours of pixels instead of letters. Open a photo in a text editor and you just see gibberish, because the editor is reading picture bytes as if they were letters.

Folders hold files, and folders hold folders

A folder (programmers also say directory, it means the same thing) is a container with a name. It can hold files and other folders. That's how your computer stays organised: folders inside folders, like drawers inside a filing cabinet.

Here is that cabinet. The cabinet is your home folder, the place your computer gives you to keep your stuff. Each drawer is a folder. Each hanging folder inside a drawer is a file. Click a drawer to pull it out, then click a file to lift it.

The file you lifted

Pick a file in the cabinet above.

A path is a file's address

To tell the computer which file you mean, you give its path: start at the top, name each folder on the way down, and end with the file's name. Slashes separate the steps.

ComputerYour home folderA file in it
Mac/Users/you/Users/you/code/hello.js
Linux/home/you/home/you/code/hello.js
WindowsC:\Users\youC:\Users\you\code\hello.js

Windows uses backslashes and starts with a drive letter, but the idea is identical. Two shortcuts you'll see everywhere:

  • ~ means “my home folder”. So ~/code/hello.js is the same file as /home/you/code/hello.js.
  • A path that starts with / (or C:\) is absolute: it works from anywhere. A path that doesn't, like code/hello.js, is relative: it starts from wherever you are right now. That “where you are right now” idea is the heart of the next lesson.

The extension is a label, not the contents

The bit after the dot, like .jpg, .txt or .js, is called the extension. It is just part of the name. It tells your computer which app to open the file with, but it doesn't change a single byte inside.

Rename cat.jpg to cat.txt and the photo is still in there: the bytes still start with ff d8 ff, the signature every JPEG begins with. Your computer will just open it in the wrong app.

Try it · rename a file

The same 12 bytes, three different names. Which app opens it changes. The bytes don't. (Bytes here are written in hexadecimal, the short form programmers use: ff is 255, d8 is 216.)

Show extensionsMac and Windows hide extensions by default, which makes this confusing. Turn them on now. On a Mac: Finder → Settings → Advanced → Show all filename extensions. On Windows: File Explorer → View → Show → File name extensions.

Why this matters for vibe coding

  • A website? A folder of files. An app? A folder of files.
  • When an AI “builds you an app”, it is writing files into a folder on your computer. Nothing more mysterious than that.
  • Know which folder, what each file is, and its path, and you're already ahead of most people asking AI for code.

You rename notes.txt to notes.md. What changed?

The extension is part of the name. Renaming never touches the contents; it only changes which app your computer offers to open it with.

You are in /home/you. Which path points at the same file as /home/you/code/hello.js?

code/hello.js is relative, so it starts from where you are (/home/you). /code/hello.js starts with a slash, so it means a code folder at the very top of the disk: a different place.

Remember
  • A file is a name plus a list of bytes (numbers 0–255).
  • A folder (directory) holds files and other folders. ~ is your home folder.
  • A path is the address: folders separated by slashes, ending in the file name.
  • The extension is part of the name. It picks the app, it doesn't change the bytes.

Keep watching

A brief history of programming · Fireship · 6 min