Step 3: Move And Copy Files

Move & Copy Files

Practice moving and copying .txt files through the Dwarf Mine. Each challenge gives you a pwd, a file location, and a destination. Type the command that sends the file there.

How to play: read the current pwd, find the purple .txt file, then type cp source.txt destination/ to copy it or mv source.txt destination/ to move it.

Example: from ~/dwarf_mine, type cp north_tunnel/foreman_note.txt workshop/ to copy that note into workshop. The pattern is cp <from> <to>: source first, destination second. Use mv the same way when the file should leave its old location.

Next step after this activity: Dwarf Mine Terminal.

Walk-Through

Current pwd

File Location

Destination

Use Command

Dwarf Mine Directory Tree

Green is your pwd. Purple shows the source file. Yellow is the destination directory.

Command Reminders

cp copies a file and leaves the original in place. mv moves a file so it leaves the original location. Both use the same pattern: command, source path, destination path.

cp source.txt folder/

Copy source.txt into folder without removing the original.

mv source.txt folder/

Move source.txt into folder and remove it from the old place.

..

Means the parent location, one level up, just like in cd practice.

~/

Starts from home, so ~/dwarf_mine/workshop works from any pwd.