In Ubuntu how do I delete a directory and everything underneath it, including directories and their contents?


What you are describing is called a recursive remove. To do this, open a shell and type:

rm -r /path/to/directory

  • brilliant. worked first time! – Yazz.com Feb 16 '10 at 15:40
  • 1
    ...and don't run this as root unless you really need to, and if you do, be very careful, especially if you add the '-f' option. – Bryan Feb 16 '10 at 16:52
cd parent-directory_of_folder_to_be_blasted
rm -r the_folder_that_needs_to_be_blasted

rmdir: The rmdir command will delete an empty directory. To delete a directory and all of its contents recursively, use rm -r instead.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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