Name

mv

Synopsis

                        mv [source] [target]

This basic command moves files and directories around on the system or renames them. Table 4.1 shows the results of various mv operations.

Table 4-1. Results of Various mv Operations

Source

Target

Result

File

name

Rename file as name

File

Existing file

Overwrite existing file with the source file

Directory

name

Rename directory as name

Directory

Existing directory

Move directory to be a subdirectory of the existing directory

One or more files

Existing directory

Move files to directory

Example

Rename a file:

% mv art.html artists.html

Move a file from one directory to another:

% mv art.html ../richard/work

Get Web Design in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.