mv source_file target_file mv source_file ... target_directory mv source_directory ... target_directory
target_file
can be a file name, a directory (in this case the file will be moved to another directory), or a directory/file name (in this case the file will be moved to another directory and renamed).$ mv folder1/file1 folder2/ #Optionally you can also specify the file name to be used for the destination folder $ mv folder1/file1 folder2/file1
$ mv folder1/file1 folder2/file2
$ mv file1 file2
$ mv folder1/ folder3/
$ mv folder1 folder3
cp
and rm
commands to move files.$ cp folder1/file1 folder2/; rm folder1/file1
-n Do not overwrite an existing file. (The -n option overrides any previous -f or -i options.) -f Do not prompt for confirmation before overwriting the destination path. (The -f option overrides any previous -i or -n options.) -i Cause mv to write a prompt to standard error before moving a file that would overwrite an existing file. If the response from the standard input begins with the character `y' or `Y', the move is attempted. (The -i option overrides any previous -f or -n options.) -v Cause mv to be verbose, showing files after they are moved.