Examples of using the mv command

To rename a file:

   mv junk precious

This renames the file junk as the file precious.


To be prompted when using the mv command:

    mv -i draft1.txt part1.txt
    remove part1.txt? n

This command prompts you to confirm that you really want to move the file draft1.txt to the file part1.txt; a file with that name already exists.

Entering n cancels this action: a y confirms it.


To move a file to another directory:

    mv precious treasure

This moves the file precious from the current directory to the directory treasure.


To move a file to another directory and rename it:

   mv jewel casket/amethyst

This moves the file jewel to the filename amethyst in the subdirectory casket.


To move and rename a directory:

   mv vr1.1 ../environments/virtual_rooms

This moves the directory vr1.1 from the current directory to the directory ../environments and renames it as virtual_rooms.


[Home] [Search] [Index]