To remove an empty directory, use the rmdir command as follows:
$ rmdir veggies3 $ |
If the directory still contains files or subdirectories, the rmdir command will not remove the directory.
Use rm -r (adding the recursive option -r to the rm command) to remove a directory and all its contents, including any subdirectories and their files, as follows:
$ rm -r veggies3 $ |
Directories removed with the rmdir command cannot be recovered, nor can directories and their contents removed with the rm -rcommand.