Linux rmdir command
The default use case of the rmdir command in the Linux system is to delete an empty directory. The below screenshot shows how to delete the empty directory. First, we created an empty directory with the help of mkdir and then deleted it using the rmdir command.
Now, let us see what will happen? If the user tries to delete a non-empty directory using this command. We had a non-empty directory dir1, and it gave an error while deleting the directory.
If you want to delete all the directory ancestors, we have a particular option for this task.
You can also check the version of the rmdir command in your Linux system using the below command option.