What is the rmdir Command in Linux?
The rmdir
command stands for remove directory. It uses to delete empty directories from the file system. Unlike rm
command, which can delete files and directories regardless of their content, rmdir
is specifically designed to remove empty directories and ensure no data is accidentally lost.
Basic syntax:
rmdir [option] [directory]
Remove an empty directory:
rmdir directory-name
Options
Option | Description |
---|---|
-p, —parents | Remove the specificed directory and its parents directories if they become empty |
-v, —verbos | Provides detailed feedback on the actions performed by rmdir |
—ignore-fail-on-non-empty | Ignore errors when attempting to remove non-empty directories |
Additional Help
You can explore more by using the commands:
rmdir --help
# or
man rmdir
Thank you!
Thank you for your time and for reading this!