Table of Contents
1. Introduction
When working with Linux, the real magic often begins with basic file operations. Whether you’re organizing configuration files, preparing codebases, or setting up automated scripts — commands like cp, mv, mkdir, and others are your everyday tools. Think of them as your file management toolkit — fast, reliable, and always available right inside your terminal.
2. The Power of Simple Commands
cp – Copy Files and Folders
What it is:
The cp command lets you copy files or directories from one place to another.
Use Case:
Copy a file from your current directory to a backup folder:
Why It Matters:
Backups often start here. You may not use cp for large-scale backup solutions (like rsync or tar), but for small manual backups or quick duplication, it's perfect.
Pro Tip:
Use -r for recursive copy (directories), and -v for verbose output.
mv – Move or Rename with Control
What it is:
Moves files/directories from one location to another. It also acts as the "rename" command in Linux.
Use Case:
Rename a file:
Move a file to another folder:
Why It Matters:
When organizing files or managing logs, mv helps clean things up or archive old files.
Pro Tip:
If you're renaming a lot of files, combine mv with shell scripting or find for batch renaming.
mkdir – Create Directories Like a Pro
What it is:
Used to create one or more directories.
Use Case:
Create a folder structure in one go:
Why It Matters:
Directory planning is key for maintainability. mkdir helps you quickly set up organized environments.
Pro Tip:
Use -p to create parent directories automatically — it saves time and prevents errors.
rm – Remove with Caution
What it is:
Deletes files or directories.
Use Case:
Remove a file:
Remove a directory and everything inside it:
Why It Matters:
Clean up is part of system maintenance. But misuse can be risky — especially when used with -rf.
Pro Tip:
On modern Linux systems like Red Hat 9, rm -rf / is blocked by default for safety — but you should never try it anyway.
If you force it using --no-preserve-root, it will attempt to delete your entire system.
Instead, set an alias to add a confirmation prompt:
touch – Quickly Create Empty Files
What it is:
Creates new, empty files or updates timestamps on existing ones.
Use Case:
Create a new log file or placeholder:
Why It Matters:
Used in scripting, testing, and placeholder creation. It’s lightweight but powerful.
Pro Tip:
Combine with mkdir to create folder/file structures for new projects:
3. Summary
The basic commands in Linux like cp, mv, mkdir, rm, and touch are more than just simple tools — they’re fundamental to daily workflows. Once you get comfortable with them, you’ll navigate your system with ease, automate smartly, and build the habits of a Linux power user.
As we progress in this 30-day journey, mastering these basics will give you the confidence to handle more advanced scripting, backups, and DevOps tasks with clarity.











Top comments (4)
I don't see the use case for using
touchto create files. I think it's a great command, for updating tinestamps, but I don't know why people promote it for file creation. (see also dev.to/moopet/creating-files-with-... )Hey Ben, thanks for coming up with this great use case. I'll check it out!
This was a good read…
Thanks for the feedback Oluwadamilola!