DevOps Bootcamp · Lesson

File Management Basics (mkdir, cp, mv, rm)

Understand how to create, copy, move, and delete files and directories efficiently using essential command-line tools.

Lesson 3 of 412 steps

File Management Basics (mkdir, cp, mv, rm) is a free DevOps Bootcamp lesson on CoddyKit. This is lesson 3 of 4. Any 3 lessons of this learning path are free to read in full — after that, CoddyKit PRO unlocks every lesson, plus hands-on practice with a built-in code editor and a 24/7 AI tutor. It is part of the DevOps Bootcamp learning path, and your progress syncs across the web and the CoddyKit app. The DevOps Bootcamp course includes 4 lessons in total.

Linux File Management

Now you'll manage files: creating, copying, moving, and deleting from the terminal. It's a fundamental skill for any Linux user or developer.

Making New Directories: mkdir

mkdir (make directory) creates new folders. Just type mkdir followed by the name you want, as shown.

mkdir my_new_folder

Creating Multiple & Nested Directories

List several names to create many folders at once. Add -p to build nested paths, creating any missing parent directories along the way.

mkdir folder1 folder2
mkdir -p projects/coddykit/lesson_files

Copying Files: cp

cp (copy) duplicates a file: give it a source and a destination. Here it copies report.txt to report_backup.txt in the same folder.

cp report.txt report_backup.txt

Copying Files to a Directory

Point cp at a directory and the file copies into it, keeping its original name. Handy for filing things away.

mkdir documents
cp presentation.pdf documents/

Copying Entire Directories: cp -r

To copy a folder and everything inside, add -r (recursive). Without it, cp refuses to copy directories.

cp -r my_project_folder backup_projects/

Moving Files: mv

mv (move) relocates files or directories. It works like cp, but the original is removed after the move.

mv important_note.txt new_location/

Renaming Files and Directories

mv also renames: move an item to a new name in the same folder. Linux has no separate rename command - mv does both.

mv old_filename.txt new_filename.txt
mv temp_folder/ final_project_folder/

Deleting Files: rm

rm (remove) deletes files - use it carefully. There's usually no trash bin in the terminal, so deleted files are often gone for good.

rm unwanted_log.txt

Deleting Directories: rm -r

Empty folders go with rmdir; non-empty ones need rm -r (recursive). Adding -f forces it - so handle rm -rf with extreme care.

mkdir empty_folder
rmdir empty_folder
mkdir project_data && touch project_data/file.txt
rm -r project_data/

Quick Check: File Operations

Which of the following commands are used to create a new directory named reports and then copy a directory named data (including its contents) into it?

Recap: File Management Basics

Recap: mkdir creates, cp copies (-r for folders), mv moves and renames, and rm deletes (-r for folders, with care). Your file-management toolkit.

Free to start

Learn DevOps Bootcamp with an AI tutor — free

Write and run real code in your browser, get instant help from a 24/7 AI tutor, and pick up where you left off on the web or in the app.

Courses
142
Lessons
568

Frequently Asked Questions

Is the “File Management Basics (mkdir, cp, mv, rm)” lesson free?

Yes — any 3 lessons of the DevOps Bootcamp learning path, including “File Management Basics (mkdir, cp, mv, rm)”, are free to read in full here on the web. After that, CoddyKit PRO unlocks every lesson, plus interactive practice with a built-in code editor and a 24/7 AI tutor. The DevOps Bootcamp course includes 4 lessons in total.

What will I learn in “File Management Basics (mkdir, cp, mv, rm)”?

Understand how to create, copy, move, and delete files and directories efficiently using essential command-line tools. You practise DevOps Bootcamp with hands-on code you run directly in the browser, and a 24/7 AI tutor answers your questions as you work through the lesson.

Do I need any experience to start DevOps Bootcamp?

No prior experience is required. DevOps Bootcamp on CoddyKit is structured for beginners through advanced learners, so you can start here or from the beginning and move at your own pace. This is lesson 3 of 4.

How long does the “File Management Basics (mkdir, cp, mv, rm)” lesson take?

Most CoddyKit lessons take about 5–10 minutes. Each one is bite-sized and interactive, so you make steady progress and pick up exactly where you left off across the web and the app.

Can I write and run code in this DevOps Bootcamp lesson?

Yes. Every DevOps Bootcamp lesson includes a built-in code editor, so you write and run real code right in your browser and get instant AI feedback — no local setup required.

All lessons in this course

  1. Introduction to Linux & Terminal
  2. Navigating the Filesystem (cd, ls, pwd)
  3. File Management Basics (mkdir, cp, mv, rm)
  4. Tab Completion & Command History
← Back to DevOps Bootcamp