Skip to main content
Module 2 · Lesson 2 of 34/11 in the course~18 min
Module lessons (2/3)

Moving and copying (mv and cp)

Lesson preview5 hands-on exercises readyLinux Terminal · Module 2 — Files and Folders

Copy files and directories, rename resources, and organize them across folders.

What you'll learn in this lesson

  • Duplicate single files and entire folder hierarchies with cp and cp -r.
  • Move resources between directories or rename them in place using a single command (mv).
  • Prevent common errors when copying a folder without recursion or moving to new name.

Overview

Duplicating, moving and renaming resources are daily operations on any server. In Linux cp (Copy) creates an independent copy leaving the source intact, while mv (Move) moves or renames the existing item.

In Linux there is no separate command to rename a single file: changing the name simply means running mv in the same directory:

Sections covered in this lesson

  1. 1cp vs cp -r vs mv
  2. 2Progressive examples
  3. 3Practical exercises
  4. 4Quick check
Pro Lesson · Module 2 — Files and Folders

Unlock "Moving and copying (mv and cp)" and the full Linux Terminal curriculum

Copy files and directories, rename resources, and organize them across folders.

Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.

  • Instant access to all advanced modules in Linux Terminal plus 17 more courses
  • Hands-on browser exercises with automated test suites and solutions
  • 14-day money-back guarantee processed via Paddle.com

14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.