File Operations

rmdir

Remove empty directories from the filesystem.

Synopsis

syntax
rmdir [OPTION]... DIRECTORY...

Examples

Remove an empty directory
rmdir temp
Remove c, then b, then a if each becomes empty
rmdir -p a/b/c
Verbosely remove multiple empty directories
rmdir -v old_*/

Common options

FlagDescription
-pRemove parent directories if they become empty
-vVerbose output
--ignore-fail-on-non-emptyIgnore errors from non-empty directories

About rmdir

The `rmdir` command remove empty directories from the filesystem. File operation commands are essential for navigating and managing the Linux filesystem.

They form the backbone of everyday system administration and development workflows. Mastering these commands enables you to efficiently create, move, copy, and organize files and directories from the terminal, which is often faster and more scriptable than graphical alternatives.

The command accepts 3 commonly used flags shown above, though the full set of options is available in the man page (`man rmdir`). The 3 examples on this page cover typical real-world usage patterns that you can copy and adapt for your own workflows.

Related commands

More File Operations Commands

Other commands in the File Operations category

Related tools