[Introduction to UNIX for Web Developers]
[Spacer] [Table of Contents]
[Next Page]
[Previous Page]
Moving and Renaming
The "mv" utility can perform two functions. First, it will move a file from one location to another such as in the following case in which the file.txt is moved one directory up

mv file.txt ../

However, if you specify a name other than the name of the file, it will move the file AND rename it. Thus, to rename a file you simply move it to the same directory but use a new name such as

mv file.txt new_name.txt

Moving is useful because instead of copying a file (which leaves two versions of the file to take up disk space and introduce confusion), the mv utility makes sure that there is only one copy.

The mv follows the standard syntax of:

mv [option] file1 file2
mv [option] space_delimited_file_list directory_name

There is only one option, the -f option which overwrites the existing file regardless of the permissions.


[mv Example]

Previous | Next | Table of Contents