next up previous contents
Next: Moving directories (mv) Up: Files and the File Previous: Creating a directory (mkdir)   Contents

Removing a directory (rmdir, rm -r)

Removing a directory is not as simple as removing a file. You cannot remove a directory unless it is empty. The command to remove a directory is rmdir. If you want to remove a directory without cleaning it out, then use the command rm -r. Use the option -r with caution because it not only gets rid of that directory but also all the subdirectories and files in it. E.g.:

malama% rmdir demons
rmdir: demons: Directory not empty
malama%
rm -r demons



h.stilmack@jach.hawaii.edu