Exploring rmdir - Linux Commands

| 2 min read

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

OptionDescription
-p, —parentsRemove the specificed directory and its parents directories if they become empty
-v, —verbosProvides detailed feedback on the actions performed by rmdir
—ignore-fail-on-non-emptyIgnore 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!