Linux [Electronic resources]

Janet Valade

نسخه متنی -صفحه : 357/ 315
نمايش فراداده

mv (move or rename a file)

Moves the contents of a file to another file or directory.

Format: mv

path/file path/file Examples: mv file1 /home/janet mv file1 file2

The first example moves the contents of file1 to the directory /home/janet, saving it with the same name (/home/janet/file1). The second example moves the contents of file1 to file2, in effect renaming the file. After both these examples, the file file1 no longer exists.

Opt

What It Does

Examples

-f

If the target file exists, overwrite it

mv -f sourcefile /home/janet

-v

Display name of file moved

mv -v file1 file2 file1 -> file2