Mission 06

Copy and move

Duplicate and rename project files while checking paths before and after.

Files and paths
8 minutes Beginner Lesson 6 of 360
cpmvlscat
Lesson 6 of 360 0/360 lessons 0/17 missions Files and paths · 8 minutes
0%
Continue View profile
Ops lab terminal Training lab
New learnerrank 0XP 0%complete
learner@clairos:/home/learner $ Unix ops lab: type a command, press Enter
Instructions 8 minutes

Click any instruction for the command details, the why, and the common mistake to avoid.

Copy a project file

Run mkdir lab, then cp projects/hello.txt lab/hello-copy.txt.

mkdir labcp projects/hello.txt lab/hello-copy.txt
Rename the copy

Run mv lab/hello-copy.txt lab/renamed.txt.

mv lab/hello-copy.txt lab/renamed.txt
Verify the rename

Run cat lab/renamed.txt.

cat lab/renamed.txt
Lesson support

What to notice while you play.

Objective

Use cp and mv without losing track of source and destination.

Hint

Copy /home/learner/projects/hello.txt into lab after making lab.

Why it matters

Copy and move mistakes are easy to prevent with a quick ls or cat.

Common mistakes
  • Moving instead of copying.
  • Forgetting that a destination directory keeps the same filename.
Reference

Commands in this lesson.

ls [-la] [path]

List lab files and folders.

cat <file>

Print text file contents.

cp <src> <dst>

Copy a file.

mv <src> <dst>

Move or rename a file.

lsof

Show simulated files and sockets opened by services.