You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

NAME

mv - move (rename) files

SYNOPSIS

mv [OPTION ...] [-T] SOURCE DESTINATION
mv [OPTION ...] SOURCE ... DIRECTORY

DESCRIPTION

Rename SOURCE to DESTINATION, or move SOURCE(s) to DIRECTORY.

OPTIONS

-i
Prompt before overwriting.

-n
Do not overwrite an existing file.

-T
Treat DESTINATION as a normal file.

-u
Move only when the source file is newer than the destination file, or when the destination file is missing.

EXAMPLES

To rename a file

mv foo.sql tariq.sql

To rename a directory

mv foo tariq

To move a directory

mv /home/tariq/shell /home/tariq/destination

 To overwrite an existing file using mv command:

mv /home/tariq/foo.sql /home/tariq/dest/foo.sql

 To prompt before overwriting an existing file using mv command:

mv -i /home/tariq/foo.sql /home/tariq/dest/foo.sql

 To move only when the source file is newer than the destination file, use the -u option

mv -u /home/tariq/foo.sql /home/tariq/dest/foo.sql

NOTES

      If both -n and -i are specified, -n will take precedence.
If both -n and -u are specified, -n will take precedence.

SEE ALSO

rename

  • No labels