•Arnošt Havelka
Practice: File Organization
Practice organizing files using mkdir and mv commands.
Start Interactive LessonTime to use your new skills! Organize a messy directory by creating folders and moving files into them.
The Scenario
Your Downloads folder is a mess. Files are scattered everywhere. Let's organize them by type.
Try the command
First: Create folders for Documents, Images, and Archives!
Build the command
mkdir[arguments]
mkdirDocuments Images Archives
Terminal
~$mkdir Documents Images Archives
mkdir: cannot create directory 'Documents': A subdirectory or file already exists.
Step 1: Create Folders
Create three new directories to organize your files.
Terminal
~/Downloads$mkdir Documents Images Archives
ls
Step 2: Organize Files
Now move each file into its appropriate folder.
Try the command
Move files to their categories!
Build the command
mv[source][destination]
mv
Terminal
~$mv report.pdf Documents/
Organize systematically:
Terminal
~/Downloads$mv letter.txt Documents/
mv report.pdf Documents/
mv photo.jpg Images/
mv backup.zip Archives/
ls
Verify Your Organization
Check inside each folder to confirm everything is in place.
Terminal
~/Downloads$ls Documents/
ls Images/
ls Archives/
Key Takeaways
- Create organizational structure with
mkdir - Use
mvto relocate files by type - Organize proactively to save time finding things
- The same pattern works for any project
Knowledge Check
1 / 3What's the first step in organizing a messy directory?
References
These documentation links provide authoritative details for the commands used in this article.
Up Next
Save command output to a file
Overwrite with >, append with >>, then check the file with cat.