Name
mv
Synopsis
mv [option]sources target
Moves or renames files and directories. In the following table, the source (first column) and target (second column) determine the result (third column):
|
Source |
Target |
Result |
|---|---|---|
|
File |
|
Rename file to |
|
File |
Existing file |
Overwrite existing file with source file. |
|
Directory |
|
Rename directory to |
|
Directory |
Existing directory |
Move directory to be a subdirectory of existing directory. |
|
One or more files |
Existing directory |
Move files to directory. |
mv doesn’t preserve resource
forks or HFS metadata when moving files that contain them. For such
files, use MvMac instead.
Options
-
-f Force the move, even if target file exists; suppress messages about restricted access modes. Overrides previous
-iand-noptions.-
-i Query user before removing files. Overrides previous
-fand-noptions.-
-n Don’t overwrite existing target files. Overrides previous
-fand-ioptions.-
-v Verbose; show files as they’re being moved.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access