Make folders and files: mkdir and touch
Create directories with mkdir and mkdir -p and empty files with touch, then check your work with ls, in a free practice terminal in your browser.
mkdir (make directory) creates a new directory:
mkdir recipeslsIt only makes the last name in the path. mkdir a/b/c fails if a/b doesn't exist yet; add -p (parents) and mkdir makes every missing level on the way, and doesn't complain about ones that already exist:
mkdir -p notes/2026/januarytouch creates an empty file, ready to be filled later. If the file exists, it leaves the contents alone and just updates its time:
touch notes/2026/january/ideas.txtls notes/2026/januaryBoth take several names at once: mkdir drafts final makes two directories, touch a.txt b.txt two files.
Naming things
Linux allows almost any name, but some make life harder. A name with a space has to be quoted every time (touch "my file.txt"), so most people use dashes or underscores instead: my-file.txt. Names are case-sensitive, so Notes and notes are two different directories.
Your turn
Make the directory ~/projects/recipes/desserts (the recipes level doesn’t exist yet), then create an empty file called brownies.txt inside it.
Your task
Make the directory ~/projects/recipes/desserts (the recipes level doesn’t exist yet), then create an empty file called brownies.txt inside it.
- Make ~/projects/recipes/desserts (not done yet)
- Create desserts/brownies.txt (a file) (not done yet)
The checklist ticks itself off as you work in the terminal: any way that gets the result counts.
Hints come one at a time, then one way to do it. Try each before the next.
What this lesson uses, in one place.
mkdir- Make directories More on mkdir →
mkdir -p- Make any missing parent directories too, and don’t complain if the directory exists More on mkdir →
touch- Create empty files, or update a file’s time More on touch →