Files and folders
The mv command
Moves files or folders. It also renames.
Syntax
mv <origen> <destino>Most useful options
-iAsks before overwriting-nDoes not overwrite if the destination existsCopy-ready examples
$ cp Documentos/apuntes.txt notas.txt && mv notas.txt final.txtRename$ cp Documentos/apuntes.txt tarea.txt && mv tarea.txt Documentos/Move into a folderYou can try them in the browser terminal: it does not touch your computer.
Typical mistakes
- Renaming is moving to the same place with a different name.
FAQ
Does mv delete the original?
Yes, it moves it: it stops being at the source.
Learn to actually use it
The basic Linux course takes you from zero to console fluency with 24 self-grading lessons.
Start the free course