Lesson 2: Working with Directories in Unix
Copying Directories
Unix used the command cp to copy folders from one directory to another
Example: Current working directory is root /
% cp training /usr – this command copies the folder training from root to the /usr directory. Note that the directory training is not removed from the root directory. A direct copy is taken.
We can add options to both the mv and cp commands when used with directories, such options are
% cp –R training /usr – copies all files and subfolders in the training directory to the /usr directory.
Moving Directores
In Unix we use the mv to move directories from one location to the other.
Example: Our current working directory / (which root)
% mv trainingdirectory /usr – this moves the directory trainingdirectory from the root directory to the /usr directory. This folder will be moved permanently from root, if you did an ls on / you would not find the directory trainingdirectory any more.