Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'm trying to learn some directory navigagtion with bash and all I know is that

rmdir directoryname

will remove the directory but not if it's containing something. Is there a way to force it to remove the subdirectories, even if they're not empty?

share|improve this question

1 Answer 1

up vote 29 down vote accepted

The following command will do it for you. Use caution though.

rm -rf directoryname
share|improve this answer
"-f" is "--force" which overrides some sanity checks and prompting. A safer command to start with would be rm -r directoryname. –  Jim Paris Aug 17 '12 at 3:35

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.