Moves/renames files or directories.
⚠️ Default behavior is to overwrite destination files.
Rename a single file
cd ~ && mv .bashrc .bashrc-renamed
Move a single file into a directory
cd ~ && mv .bashrc Documents
Note that the
Documentsdirectory should exist.
Move a single file onto a specific new path (filename)
cd ~ && mv .bashrc Documents/.bashrc-moved
Move a whole directory
mv my-src-dir ~/Documents/my-dest-dir
⚠️ Note that if
my-new-srcwill be moved under it; i.e., you would have your files under
Create backup for existing destination files
cd ~ && mv -b .bashrc Documents/.bashrc-moved
Move by wildcard selection
cd ~ && mv -t target-dir *.zip *.txt
Set to ask for overwriting
cd ~ && mv -i .bashrc Documents
Set to keep existing files (no overwrite)
cd ~ && mv -n .bashrc Documents
About Living in the Shell
Obsessed with doing things in the shell, I’ve decided to share my daily struggles on living in the shell as terse but informative posts.