Move a file and prompt if the destination exists.
mv -i draft.txt ./archive/Move or rename files and directories.
mv [OPTION]... SOURCE... DESTINATIONMove a file and prompt if the destination exists.
mv -i draft.txt ./archive/Rename a file in the same directory.
mv old-name.txt new-name.txt| Option / clause | Description |
|---|---|
-i, --interactive | Prompt before overwriting a destination. |
-n, --no-clobber | Do not overwrite an existing destination. |
-f, --force | Do not prompt before overwriting. |
-u, --update | Move only when the source is newer or destination is missing. |
-t, --target-directory=DIR | Move all sources into DIR. |
-v, --verbose | Explain what is being moved. |
Review a command and its target before running it. Commands that alter files, services, accounts, disks, permissions or databases may be difficult to reverse. Test in a safe environment and keep backups.