DEV Community

1suleyman
1suleyman

Posted on

๐Ÿ–ฅ๏ธ How I Learned to Copy, Move, and Delete Like a Pro (All from the Command Line)

Hey everyone ๐Ÿ‘‹

If you're learning to code, manage servers, or just want to feel like a terminal ninja, you'll eventually need to do more than just look at files โ€” you'll need to manipulate them. That means copying, moving, renaming, or deleting files and folders โ€” and doing it fast.

I just finished the Manipulation module of the Codecademy command-line course, and let me tell you โ€” this stuff makes you feel powerful ๐Ÿ’ช

Hereโ€™s a breakdown of what I learned, explained the way I wish someone had told me early on ๐Ÿ‘‡


๐Ÿงฐ Think of It Like Managing a Warehouse

Imagine your computer as a giant digital warehouse ๐Ÿญ

  • Each file is a box.
  • Each folder (directory) is a room.
  • The command line is your forklift ๐Ÿ›ป

Youโ€™re not dragging and dropping with a mouse โ€” youโ€™re issuing instructions like a boss:

โ€œMove these two boxes to that room. Now delete the ones labeled โ€˜junk.โ€™โ€


๐Ÿ“‹ The Core File Commands I Learned

Letโ€™s run through the key tools โ€” each one does something simple, but when combined, theyโ€™re unstoppable.


๐Ÿ“‚ cp โ€” Copy Files (or Entire Stacks of Them)

Copy a single file:

cp source.txt destination.txt
Enter fullscreen mode Exit fullscreen mode

โžก๏ธ Makes a duplicate.
Great for backups or creating template files.

Copy into a folder:

cp resume.txt job_apps/
Enter fullscreen mode Exit fullscreen mode

Copy and rename at the same time:

cp resume.txt job_apps/resume_2025.txt
Enter fullscreen mode Exit fullscreen mode

Copy multiple files:

cp file1.txt file2.txt my_folder/
Enter fullscreen mode Exit fullscreen mode

Use wildcards for batch copy:

cp *.txt text_files/
Enter fullscreen mode Exit fullscreen mode

๐Ÿšš mv โ€” Move or Rename Files

Move files like youโ€™re relocating inventory:

mv draft.txt archive/
Enter fullscreen mode Exit fullscreen mode

Rename files:

mv draft.txt final.txt
Enter fullscreen mode Exit fullscreen mode

Move multiple files at once:

mv a.txt b.txt c.txt folder/
Enter fullscreen mode Exit fullscreen mode

๐Ÿ—‘๏ธ rm โ€” Delete with Caution (Seriously)

Delete a file:

rm badfile.txt
Enter fullscreen mode Exit fullscreen mode

Deletes a file.
No Recycle Bin. No โ€œAre you sure?โ€ Just gone.

Delete entire folders and their contents:

rm -r old_logs/
Enter fullscreen mode Exit fullscreen mode

Want a safety net? Use interactive mode:

rm -i filename
Enter fullscreen mode Exit fullscreen mode

It will ask for confirmation before deleting.

๐Ÿƒ Wildcards โ€” Your Command Line Superpower

Use the * symbol to target multiple files:

Pattern Matches...
.txt All .txt files
backup
Files starting with backup
data Files with "data" in the name

Example:

cp backup*.txt archive/
Enter fullscreen mode Exit fullscreen mode

Boom โ€” done. ๐Ÿ”ฅ

๐Ÿ’ฅ Combining Commands = Efficiency

The real power comes when you chain commands:

cp *.log backup/
mv backup/*.log archive/
rm -r backup/
Enter fullscreen mode Exit fullscreen mode

Youโ€™ve just performed copy โžก๏ธ move โžก๏ธ cleanup in seconds.

๐Ÿงฉ Final Thoughts

This module taught me that the command line isnโ€™t just about navigating around โ€” itโ€™s about commanding your computer with clarity and speed.

By mastering:

  • cp to duplicate
  • mv to move or rename
  • rm to delete
  • and * wildcards to target like a sniper

โ€ฆ you can automate and manage files like a pro โ€” whether youโ€™re building web projects, managing logs, or setting up production servers.

Learning this stuff made me feel 10x more confident in the terminal โ€” and I'm just getting started.

Are you learning the command line too? Got questions or tips? Letโ€™s connect LinkedIn โ€” Iโ€™d love to swap notes and war stories from the terminal world ๐Ÿง ๐Ÿ’ฌ

Top comments (0)