How to remove / delete a directory with contents in Linux

Had one of those brain fart moments where I needed to delete a directory with all it's contents and couldn't for the life of me remember the command.
I thought it was something like,

But after reading the man file for "rmdir", I realized it was used for removing empty directories. So a quick Google search later revealed that I was close but still no cigar,

Just "rm" was all you needed. Also if you wanted to see the contents getting deleted instead of just waiting for it to finish, you could also use the verbose swith.

But there is a more simpler way of removing a directory with contents, just use the recursive switch.

And for recursive with the verbose switches,

Hope this helps someone avoid wasting their time on such a simple task!

Leave a Comment

  • Info

    I typically try and keep the blog up-to-date but apparently I'm not very good at posting!