Creating Files and Folders
Now let's create things! These commands are essential for setting up projects.
Creating Folders: mkdir
mkdir means "make directory" (directory = folder):
$ mkdir my-project
$ ls
my-project
$ cd my-project
$ pwd
/Users/john/my-project
โ
Create Nested Folders
Use -p to create parent folders automatically:
$ mkdir -p projects/2026/april/my-app
# Creates all folders in the path!
โ
Creating Files: touch
touch creates an empty file:
$ touch index.html
$ touch styles.css script.js
$ ls
index.html script.js styles.css
โ
โTip
You can create multiple files at once by listing them with spaces!
A Real Example
Let's create a project structure:
$ cd ~
$ mkdir -p projects/my-website
$ cd projects/my-website
$ mkdir src public
$ touch src/index.js src/styles.css
$ touch public/index.html
$ ls -R # Show everything recursively
.:
public src
./public:
index.html
./src:
index.js styles.css
โ
Deleting: rm and rmdir
โ Warning
โ ๏ธ Terminal deletions are permanent - no Trash/Recycle Bin! Double-check before deleting.
# Delete a file
$ rm unwanted-file.txt
# Delete an empty folder
$ rmdir empty-folder
# Delete a folder and everything inside (careful!)
$ rm -r folder-with-stuff
# Delete with confirmation prompts
$ rm -ri folder-with-stuff
โ
Renaming and Moving: mv
mv does both moving and renaming:
# Rename a file
$ mv old-name.txt new-name.txt
# Move to another folder
$ mv file.txt Documents/
# Move and rename
$ mv file.txt Documents/new-name.txt
โ
Copying: cp
# Copy a file
$ cp original.txt copy.txt
# Copy to another folder
$ cp file.txt Documents/
# Copy a folder (need -r for recursive)
$ cp -r my-folder my-folder-backup
โ
๐ฆ๐บAussie Note
Creating a CLAUDE.md file will be important later. For now, just remember: touch CLAUDE.md creates it! ๐
Quick Reference
| Command | What it does |
|---|
mkdir folder | Create a folder |
mkdir -p a/b/c | Create nested folders |
touch file.txt | Create empty file |
rm file.txt | Delete file |
rm -r folder | Delete folder and contents |
mv old new | Move or rename |
cp src dest | Copy file |
cp -r src dest | Copy folder |