Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I checked the man page for it using man rmdir and all it has is --ignore-fail-on-non-empty, -p, -v, --help, and --version. What am I missing?

I'm using Ubuntu 12.04 LTS

share|improve this question
up vote 4 down vote accepted

rmdir has no -r option. The purpose of rmdir is to delete only empty directories.

If you want to delete non-empty directories, that's when you'll use the -r option of the command rm.

  • Delete empty directory called emptydir:

    $ rmdir emptydir
  • If directory nonemptydir is non-empty, you'll have an error:

    $ rmdir nonemptydir
    rmdir: failed to remove `nonemptydir': Directory not empty
  • To delete non-empty directory nonemptydir:

    $ rm -r nonemptydir

Hope this helps!

share|improve this answer
OK thanks. Some of the websites I found when googling this had rmdir -r for some reason, or maybe its just because I've been awake all night :P – Alex Mohr Sep 28 '13 at 15:27

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.