Unix Manual Pages

A History of Unix

Unix in Summary

An introductory tutorial on Unix...


Selecting a Shell

Regular Expressions...

Perl and Unix...

Help with vi...

Shell scripting...


The 10 Unix commands every beginner needs to know...

The 10 most misunderstood commands...

The 62 Core Commands

Commands by Category

Alphabetic list of commands...


Copyright/Copyleft info...

mv





DESCRIPTION
move files
SYNOPSIS
mv [-f] [-i] source target
mv [-f] [-i] source ... directory
USAGE
In the first form, the file (named by source) is moved to the destination path (named by target.)
In the second form, the series of files is moved to the target directory.
  • the user must own the file
  • the user must own the directory
  • the file must be writable by the user
  • the user must be a privileged user
mv is equivalent to copying, then removing the source:
rm -f destination_path && \
cp -pRP source_file destination && \
rm -rf source_file
OPTIONS
-f
Do not prompt if moved file will overwrite an existing file.
-i
Prompt if moved file will overwrite an existing file.
Some versions of mv will generate an error if both flags are used, in other versions only the latter flag will be used.
OPERANDS
source
A path name of a file or directory to be moved.
target_file
A new path name for the file or directory being moved.
target_dir
A path name of an existing directory into which to move the input files.
ENVIRONMENT VARIABLES
LC_CTYPE
LC_MESSAGES
NLSPATH
EXITING
0 for success, and >0 if an error occurs.
SEE ALSO
cp
rm
© 1999-2004 Matchstick Consulting