You are here: >

Linux and Unix rmdir command

rmdir commandAbout rmdir
rmdir syntax
rmdir examples
Related commands
Linux and Unix main page

About rmdir

Removes a directory.


The rmdir utility removes the directory entry specified by each directory argument, provided the directory is empty.

Arguments are processed in the order given. To remove both a parent directory and a subdirectory of that parent, the subdirectory must be specified first so the parent directory is empty when rmdir tries to remove it.

rmdir syntax

rmdir [-p] directory ...


--ignore-fail-on-non-empty ignore any failure which occurs solely because a directory is non-empty.
-p Each directory argument is treated as a pathname of which all components will be removed, if they are empty, starting with the lastmost component. (See rm for fully non-discriminant recursive removal.)
-v, --verbose Display verbose information for every directory processed.
--help Display a help message, and exit.
--version Output version information, and exit.

rmdir examples

rmdir mydir

Removes the directory mydir.

mkdir — Create a directory.
rm — Delete files.