Terminal basics: Move files
When using Terminal, you might have to move files from one directory to another. This is where mv comes in.
Using this command is fairly easy:
mv source target
is all you need. Let’s assume that you’re in your home directory and there’s a file called move.me that you want to put into your Documents folder:
mv move.me Documents/move.me
Note that you can also use this command to rename a file by simply changing the name when specifying the target!
There is one option that’s necessary to know, and that is -i, which will ask if you want to overwrite the file, if the target directory already contains a file with the same name:
mv -i move.me Documents/move.me
There are more options available, if you want to learn about them, simply enter
to open the manual for mv.
Do you have anything to add or did you spot any mistakes? Please let me know by commenting on this post.