Making Things: Folders and Files
Here is the plain idea: you can create brand-new folders and brand-new files just by typing their names. Up to now we've been looking — finding our spot, listing contents, walking around. Now we start building. This is the moment the terminal turns from a place you explore into a place where you make things.
And it's wonderfully direct. You say "make a folder called X," and a folder called X appears, right where you're standing. No dialog boxes, no "Save As" window — just the thing you asked for.
Setting out empty boxes
Think of organizing a move into a new house. Before you can pack, you set out empty boxes and label them: "Kitchen," "Books," "Photos." The boxes are empty for now, but each one has a clear name and a clear job, ready to be filled.
Making a folder is setting out a labeled empty box. Making a file is more like setting out a blank sheet of paper, ready for writing. Both start empty; both are yours to fill. 🔦
Making a folder
The command is mkdir, short for "make directory" — make a new folder. Type it, a space, and the name you want:
mkdir projects
Press Enter, and a new empty folder called projects appears inside your current location. Run ls and you'll see it sitting there. You can now cd projects to walk inside your fresh, empty room.
Remember where you're standing matters: the folder is created right where your "you are here" dot is. So if you wanted it in Documents, make sure you cd there first. (When in doubt, pwd to check.)
Making a file
For a quick, empty file, the command is touch, followed by the file name you want — including the little ending that says what kind of file it is:
touch notes.txt
That .txt on the end is the extension — a short tag that tells the computer (and you) what sort of file this is. .txt means plain text, .jpg means a photo, .md means a markdown note. The name notes.txt says "a plain-text file called notes."
Press Enter and an empty file notes.txt appears. (The command is called touch because its original job was to gently "touch" a file's timestamp — but its handy side effect is creating the file if it doesn't exist yet.)
Building a little structure
Here's where it gets satisfying: you can combine these to build a tidy structure fast. Make a folder, step into it, and fill it:
mkdir trip
cd trip
touch packing-list.txt
touch budget.txt
In four short lines you've built a trip folder with two files inside it, all neatly contained. Run ls and admire your work. This is the seed of the capstone you'll build at the end of the course.
A note on good names
Since you're typing these names over and over, kind-to-yourself names pay off. A few gentle habits:
- Skip spaces. Use a hyphen or underscore instead:
packing-list.txtrather thanpacking list.txt. It saves you the quote-wrangling from the last lesson. - Stay lowercase. It's less to think about and dodges the capital-letter mix-ups.
- Be clear, not clever.
budget.txttells you what's inside;b.txtwon't, two weeks from now.
These aren't rules anyone enforces — they're just little kindnesses to your future self.
Your turn
In your terminal, cd somewhere comfortable (your home folder or Documents). Then type mkdir practice and press Enter. Run ls to see your new folder.
Now cd practice, then touch hello.txt, and ls once more. You just built a folder and a file out of nothing but words. The blank room is yours, and you furnished it.
Next up: copying, moving, and renaming — rearranging the things you've made. 🐙
Stuck or curious?
Ask Pip about this lesson — tap the porthole bottom-right.