Solaris Advanced User's Guide

Moving and Renaming Directories

You rename a directory by moving it to a different name. Use the mv command to rename directories.


$ pwd
/home/user2/veggies
$ ls
broccoli
$ mv broccoli carrots
$ ls
carrots

You can also use mv to move a directory to a location within another directory.


$ pwd
/home/user2/veggies
$ ls
carrots
$ mv carrots ../veggies2
$ ls ../veggies2
carrots

In this example, the directory carrots is moved from veggies to veggies2 with the mv command.