Module 2~9 min
Working with Files and Directories
Beyond navigating, Linux gives you simple commands for creating, copying, and removing files and folders.
What You'll Learn
- How to create files and folders
- How to copy and move files
- How to safely remove files
Creating Files and Folders
The `mkdir` command creates a new directory, and `touch` creates a new, empty file. These are among the first commands most Linux users learn.
Copying, Moving, and Removing
The `cp` command copies files, `mv` moves or renames them, and `rm` removes them. Because `rm` deletes files immediately without a recycle bin, it's worth using carefully.
Example
Running `mkdir notes` creates a folder called notes, and `touch notes/todo.txt` creates an empty file inside it, ready to be edited.
Key Concepts
mkdircprm
Key Takeaways
- `mkdir` creates directories and `touch` creates empty files
- `cp` copies files and `mv` moves or renames them
- `rm` deletes files immediately, so it should be used carefully
Knowledge Check
Which command creates a new directory?