Work with Linux files and directories
Learn the everyday file-management commands and build a habit of checking your path and target before changing data.
Create and inspect
mkdir practice touch practice/notes.txt ls -l practice cat practice/notes.txt
mkdir creates directories and touch creates an empty file when it does not already exist. ls -l shows useful metadata.
Copy and move
cp practice/notes.txt practice/backup.txt mv practice/backup.txt practice/archive.txt ls -l practice
cp makes a copy while mv moves or renames an entry. The destination matters: always verify it before using a command that changes files.
Remove carefully
rm practice/archive.txt rmdir practice/empty-directory
Safety rule: Treat
rm as irreversible. In a real system, pause and verify the path rather than experimenting with destructive options. Practice destructive commands only on disposable data.Useful mental model
| Command | Think of it as |
|---|---|
mkdir | Create a directory |
touch | Create/update a file timestamp |
cp | Copy |
mv | Move or rename |
rm | Remove a file |