O'Reilly logo

Mac OS X Tiger in a Nutshell by Jason McIntosh, Chuck Toporek, Chris Stone, Andy Lester

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Name

mv

Synopsis

mv [option] sources target

Moves or renames files and directories. In Table 2-4, the source (first column) and target (second column) determine the result (third column).

Table 2-4. Sources, targets, and results for the mv command

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.

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 -i and -n options.

-i

Query user before removing files. Overrides previous -f and -n options.

-n

Don't overwrite existing target files. Overrides previous -f and -i options.

-v

Verbose; show files as they're being moved.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required