S5 version Table of Contents (frame/ no frame)
(16) Working with directories Previous Top Next

Working with Directories

Creating, moving and removing directories.
mkdir frog
Makes a directory named "frog".
mv frog toad
Moves a directory, removes the old directory (effectively a rename). This only works if they are on the same filesystem.
cp -r toad lizard
Copies one directory to another. The "-r" flag says to recursively copy files and subdirectories. This is only one (not the best) of several ways to copy a directory hierarchy.
rmdir toad
Removes a directory, if the directory is empty.
rm -r toad
Will remove a directory even if it is not empty. Again, "-r" indicates recursive action, deleting all the contents first. Use with caution.
ln -s lizard snake
Links (similar to a Macintosh alias) one file to another. Think of it as creating a "pointer" to a file or directory; good for creating easy access to a shared resource. Take a look at this with a ls -l.. "lizard" is the real file, while "snake" is the alias for it.

lrwxrwxrwx 1 jwallace web   6 Oct 14 20:02 snake -> lizard

Previous Top Next


slide18.src  last modified Jan 31, 2011 Introduction Table of Contents
(frame/no frame)
Printable
(single file)
© Dartmouth College