rmdir
The command that removes a directory only if it is empty.
In more detail
Its refusal to delete anything with contents makes it a safe way to tidy up. Use rm -r when you really mean to remove a directory and everything in it.
Related terms
- rm — The command that deletes files, and with -r whole directory trees, permanently.
- mkdir — The shell command that makes a new directory; with -p it also makes missing parent directories and does not complain if the directory already exists.
Taught in
- Making, Copying, Moving And Removing — Bash Scripting & Command Line Automation