Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
mv [option] sources target
Move or rename files and directories. The source (first column) and target (second column) determine the result (third column):
| Source | Target | Result |
|---|---|---|
| File | name (nonexistent) | Rename file to name. |
| File | Existing file | Overwrite existing file with source file. |
| Directory | name (nonexistent) | Rename directory to name. |
| Directory | Existing directory | Move directory to be a subdirectory of existing directory. |
| One or more files | Existing directory | Move files to directory. |
The mv command is often aliased as mv -i in the .bashrc file, especially for the root account, to prevent inadvertently overwriting files.