brock

How to Remove Non-Empty Directories in Linux

02 Nov 2008

Here is one that I am using all the time: deleting directories or an entire directory in Ubuntu (linux). It's very easy (and dangerous) as it will delete everything without asking for confirmation. But very handy when you know you just want to delete it all quickly.

This is dangerous! Use with caution!

sudo rm -r *

That deletes everything inside the current directory. But if you want to delete an entire directory that is inside your current directory, you do this:

rm -r directoryname

Be careful, and good luck! :)