DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Working with files and directories

Moving or renaming a file

To move one or more files to another directory, use the mv(C) command, as follows:

mv filename ... pathname

The one or more filename arguments (with optional path) specify the file or files you want to move; pathname is the path to the directory where you want to put the file.

For example, to move the file project1 from your current directory to the directory /u/workgrp, type the following:

   $ mv project1 /u/workgrp
The procedure for moving files is the same as for renaming files. You rename a file by moving it to a new filename. To move (rename) a file, type the following:

mv old_filename new_filename

old_filename is the file's current name and new_filename is the name you want to change it to.

You can move a file to a different directory and rename it at the same time. For example, the following command line moves chapter.1 to /u/workgrp and renames it to finished.chapter.one at the same time:

   $ mv chapter.1 /u/workgrp/finished.chapter.one
You can place files in any directory to which you have write permission. To move a file, you need read permission unless you own it.


NOTE: If you give a file the same name as an existing filename, the contents of the existing file are overwritten or ``clobbered''. The existing file is deleted. (You can make the system refuse to overwrite existing files by setting the noclobber variable: see ``Specifying command input and output'' for details.)


Next topic: Removing a file
Previous topic: Copying a file

© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003