Beginner Linux · 30 min
Files and folders
Create, copy, rename, and remove the files that make up your work.
Learn the commands
Commands to know
Everything you need for this lesson is here. Use the full guide only when you want more options and examples.
mkdir
Read full guide →Create a new folder.
- Syntax
- mkdir <name>
- Example
- mkdir notes
Tip: Use mkdir -p projects/app to create missing parent folders too.
touch
Read full guide →Create an empty file or update a file timestamp.
- Syntax
- touch <file>
- Example
- touch notes/today.txt
Tip: It does not add text to a file; use an editor or redirect for that.
Copy a file or folder to a new location.
- Syntax
- cp <source> <destination>
- Example
- cp notes/today.txt notes/tomorrow.txt
Tip: Use cp -r when copying a folder and everything inside it.
Move a file or rename it.
- Syntax
- mv <source> <destination>
- Example
- mv draft.txt final.txt
Tip: If the destination already exists, mv can replace it without asking.
Remove a file you no longer need.
- Syntax
- rm <file>
- Example
- rm notes/old.txt
Tip: Use rm carefully: it normally removes files immediately, without a recycle bin.
Try it
Practice exercise
Create a notes folder and practice copying, renaming, and removing a file.
Open playgroundYour progress
Mark this lesson when you feel ready to move on.
Your progress is saved on this device. Log in to back it up and continue anywhere.