rmdir (remove empty directories)
This command removes a directory, like this:
The directory must be empty for the call to rmdir to succeed. Why not use →rm -r? It's true that rm -r has the same effect, but rmdir is safer. It only lets you remove directories that are empty, so it's impossible to delete important files by mistake.
Use the option -p (“parents”) to delete a whole directory hierarchy, like so:
rmdir -p a/b/c
This will remove the directory c along with its parent directories b and a. The above invocation of rmdir is equivalent to:
rmdir a/b/c a/b a