O'Reilly logo

The Linux Command Line by William E. Shotts Jr.

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

mv—Move and Rename Files

The mv command performs both file moving and file renaming, depending on how it is used. In either case, the original filename no longer exists after the operation. mv is used in much the same way as cp:

mv item1 item2

to move or rename file or directory item1 to item2 or

mv item... directory

to move one or more items from one directory to another.

mv shares many of the same options as cp, as shown in Table 4-6 and Table 4-7.

Table 4-6. mv Options

Option

Meaning

-i, --interactive

Before overwriting an existing file, prompt the user for confirmation. If this option is not specified, mv will silently overwrite files.

-u, --update

When moving files from one directory to another, move only files that either don’t exist in the destination ...

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