cp and mv both work with a source and destination. Understanding whether the last argument is a new name or an existing directory matters more than memorizing isolated forms.
cp: keep the original
cp notes.txt notes-backup.txt creates an independent copy. If the destination is an existing directory, cp notes.txt backup/ keeps the filename and places a copy there. Multiple sources can be written as cp notes.txt todo.txt backup/; the last argument must then be a directory.
cp source destination The source remains and the destination gets a copy.
mv source destination The source leaves its old location; the destination may be a directory or a new name.
cp -r project project-backup Recursively copy a directory and everything inside it.
cp -i source destination Ask before overwriting an existing destination.
Directory copies and overwrite risk
Ordinary cp generally refuses to copy a directory. Use cp -r project project-backup to copy the entire tree. Copying to an existing filename normally overwrites it; cp -i can prompt first.
mv: moving is also renaming
mv notes.txt archive/ places the file in an existing directory and removes it from the old location. mv draft.txt report.txt moves it to a new name in the same directory—in other words, it renames it. Directories work the same way.
Decision rule: an existing destination directory receives the item; a new destination name usually means copy-and-rename or a direct rename.
Watch Source and Destination
Simulated terminal ready. Run commands and watch the filesystem on the right.
/homealicearchivebackupcachedataindex.bin
DocumentsDownloadsemptyPicturesprojectsrcREADME.md
.bashrc.profileaccess.logapp.logdraft.txterror.lognotes.txt
varlogsyslog
Quick buttons fill the prompt; run the command or press Enter to change terminal and filesystem state.KNOWLEDGE QUIZ
KNOWLEDGE QUIZ
Organize Release Candidates
The current directory contains app/, README.md, and draft.txt, plus existing backup/ and archive/ directories. Write commands for these tasks.
- Recursively copy app/ to backup/app-v1/.
- Copy README into backup and prompt before overwrite.
- Rename draft.txt to release-notes.txt, then move it into archive.