One of the main uses of the mv is to move or rename files (directories are discussed on the next page).

Command Format

mv [options] source destination

Absolute and relative pathnames can be specified when moving files and directories.

Examples

The following is an example of how to rename files in the current directory:

$ cd /Snoopy/Cool_dog

$ ls

Hero Charlie_Browns_friend

$ mv Charlie_Browns_friend genius

$ ls

Hero genius

The following is an example of how to move files into another directory:

$ pwd

/home/chuck/Snoopy/Cool_dog

$ ls

dog house

$ mv dog /home/chuck/bird

$ ls /home/chuck/bird

dog

$