DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Managing files

Renaming files

To rename a file on a UNIX system, use the mv (move) command. You can also use mv to ``move'' a file from one directory to another. To rename a file using mv, type mv, the name of the file you want to rename, the new name you want to call it, and press <Enter>.

mv mydir/afile /tmp

For example, if you want to rename the file mytodo as monday, type:

mv mytodo monday

If you want to move monday to the temporary directory /tmp, type:

mv monday /tmp

Try making a directory for to-do lists and moving the file mytodo into it. (If you do not have the file mytodo from the writing and editing lessons in ``Writing and editing'', use the cat command or the vi editor to create a file called mytodo containing a to-do list. See ``Writing and editing'' for instructions.)

  1. If you are not already in your home directory, type cd and press <Enter>.

  2. Type mkdir Todos and press <Enter> to create a directory called Todos.

  3. Move mytodo to the new directory by typing mv mytodo Todos and pressing <Enter>.

  4. Check the contents of the Todos directory by typing ls Todos and pressing <Enter>.
    $ mkdir Todos
    $ mv mytodo Todos
    $ ls Todos
    mytodo
    

Next topic: Removing files
Previous topic: cp mydir/afile /tmp

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 03 June 2005