📡 You're offline — showing cached content
New version available!
Quick Access

Linux File Operations: cp, mv, rm, mkdir, touch

Learn touch, cp, mv, rm, mkdir — file and directory manipulation.

EzyCoders Admin April 16, 2026 1 min read 0 views
Linux File Operations: cp, mv, rm, mkdir, touch
Share: Twitter LinkedIn WhatsApp

What is it?

Basic file operations — create, copy, move, delete — use a handful of commands.

Why does it matter?

File operations are the most common terminal tasks. Knowing the options prevents data loss.

Learn touch, cp, mv, rm, mkdir — file and directory manipulation.

Real-World Use Cases

  • 💡 Real-world use - Practical application.
  • Performance - Critical skill.
  • 🏢 Professional - Industry standard.
  • 📚 Learning - Career essential.

Core Concept

Key commands:

  • touch → create empty file / update timestamp
  • cp → copy files/directories
  • mv → move or rename
  • rm → delete files/directories

Example

# Create files & directories
touch file1.txt
mkdir project

# Copy file
cp file1.txt project/

# Copy directory
cp -r project backup_project

# Move / rename
mv file1.txt file2.txt
mv file2.txt project/

# Delete file
rm project/file2.txt

# Delete directory
rm -r backup_project

Best Practice

  • Use -i for safety (interactive)
  • Avoid accidental deletes
  • Prefer verbose mode for clarity
  • Use absolute paths in scripts
  • Backup before bulk operations
  • Use rsync instead of cp for large data
 

Q: How do I safely delete files in Linux?

rm removes permanently with no trash bin. Use rm -i for interactive confirmation. Check with ls before rm -rf.

EzyCoders Admin
Written by
EzyCoders Admin

Team Lead and Full-Stack Developer with experience in PHP, JavaScript, SQL, DSA, and System Design. Passionate about software engineering, scalable web technologies, and helping developers prepare for coding interviews and tech careers through practical tutorials and professional guidance.

Comments (0)

No comments yet. Be the first!

Leave a Comment