In Linux or Unix-Like operating systems, the rmdir command is useful to delete a directory (empty directories). Generally, it removes an empty directory. It is an excellent command to delete the empty directory. Sometimes it’s handy, but as it deletes only that directory that is empty, this does not make any sense to use it. But you must be familiar with this command, this is fine. So let’s have a look at this command.
If you like to watch the rmdir command video then you can watch the video.
How to get help for the rmdir command
I always suggest reading the manual page and helping. It will give you an in-depth introduction to the command.
To get the manual page type the below command,
man rmdir
But, to get the only command options, you can type the below command.
rmdir --help
Syntax of the rmdir command
Now you know how to get help with the rmdir command. So, let’s talk about rmdir syntax. The syntax of the rmdir command is as below,
Syntax: rmdir [OPTION]… DIRECTORY…
Creating an empty directory using the mkdir command
I’m creating a directory with the name amit in the root home directory, And then I’ll use the ls -l command to verify it. Here we are using the mkdir command to create the directory so we can use it for our demo of the rmdir command.
mkdir /root/amit
So, you can take look at the below picture.

Deleting an empty directory using the rmdir command
Now I am going to use rmdir to delete this empty directory amit. And then I’ll use the ls -l command to verify it.
rmdir /root/amit
As a result, you can see in the picture.

If you want to delete a non-empty directory, then you can read about the Linux rm command
Conclusion
In this article, we learn about the rmdir command in Linux, and you can see that it is easy to use. So, I hope you understand, but if you have any questions, you can ask in the comment section.
Also, you may like to read.