Name

rmdir [options] directories — coreutils

Synopsis

/bin stdin stdout - file -- opt --help --version

The rmdir (remove directory) command deletes one or more empty directories you name. To delete a nonempty directory and its contents, use (carefully) rm -r directory. Use rm -ri directory to delete interactively, or rm -rf directory to annihilate without any error messages or confirmation.

Useful options

-p

If you supply a directory path (not just a simple directory name), delete not only the given directory, but the specified parent directories automatically, all of which must be otherwise empty. So rmdir -p /one/two/three will delete not only /one/two/three, but also /one/two and /one if they exist.

Get Linux Pocket Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.