Module 1: Terminal BasicsLesson 5 of 7
0%
Lesson 5ยท4 min

Creating Files and Folders

Learn to create and organize your project files

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):

Terminal
$ mkdir my-project
$ ls
my-project
$ cd my-project
$ pwd
/Users/john/my-project
โ–Œ

Create Nested Folders

Use -p to create parent folders automatically:

Terminal
$ mkdir -p projects/2026/april/my-app
# Creates all folders in the path!
โ–Œ

Creating Files: touch

touch creates an empty file:

Terminal
$ 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:

Terminal
$ 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.
Terminal
# 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:

Terminal
# 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

Terminal
# 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

CommandWhat it does
mkdir folderCreate a folder
mkdir -p a/b/cCreate nested folders
touch file.txtCreate empty file
rm file.txtDelete file
rm -r folderDelete folder and contents
mv old newMove or rename
cp src destCopy file
cp -r src destCopy folder