Examples of using the mv command

1. To rename a file:

   mv junk precious

This renames the file junk as the file precious.

2. To be prompted when using the mv command:

    mv -i draft1.txt part1.txt
    remove part1.tx?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.

3. To move a file to another directory:

    mv precious treasure

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

4. 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.

5. 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.


Top document