Make a file
Create files with touch
⏱ Est. ~5 min
01 · Read
You can make folders — now let's make files. The touch command creates a new empty file.
💡 Picture thisIf mkdir is building a new room, touch is putting a blank notebook inside — ready for you to write in later.
Key points
- touch creates a new empty file
- You pick the filename, extension included
- If the file already exists, touch only updates its timestamp
02 · Terminal exercise
Folders are ready. Now let's add some files.
(This section is interactive — please enable JavaScript.)
03 · Terminal exercise
Confirm it's there.
(This section is interactive — please enable JavaScript.)
04 · Quiz
What happens if you touch a file that already exists?
- It deletes the file
- It overwrites the file with an empty one
- It throws an error
- Nothing — it just updates the timestamp
05 · Terminal exercise
You can create files inside subfolders without cd-ing into them first.
(This section is interactive — please enable JavaScript.)
06 · Terminal exercise
One more — make a JavaScript file inside the js folder.
(This section is interactive — please enable JavaScript.)
07 · Fill in the blank
To create an empty file called index.html, you'd type: ___ index.html
Other lessons in this chapter
⚠ The full interactive experience needs JavaScript. Please enable it and reload.
※ This is an independent Traditional Chinese teaching project — not an official Anthropic product. Claude™ is a trademark of Anthropic, PBC.