Another main function of the mv command is to move or rename directories. The following is an example of how to use the mv command to rename directories within the current directory.

$ pwd

/home

$ ls


genius Snoopy Franklin marcy Linus
chuck Woodstock blankets file4 game
chuck_1 Pig_Pen sally_6 compositions mud.puddles

$ mv Linus monthly

$ ls

genius Snoopy Franklin marcy monthly
chuck Woodstock blankets rerun game
chuck_1 Pig_Pen blankets_6 compositions     mud.puddles
$

The following is an example of how to use the mv command to move a directory and its contents into another directory:

$ pwd

/home/chuck

$ls monthly

compositions

$mv monthly compositions

$ls compositions

monthly

$