Go2Linux | Linux Operating System

A site dedicated to: Linux Operating System

Small tip - How to erase a directory and all its contents in Linux

Date: 2009-01-08 00:00:00 -0400

When you use rmdir without the -r option, and the directory is not empty, you will get this message

rmdir: failed to remove `tmp': Directory not emptyill get a 

So if you want to delete a directory with all its contents, you may use two different commands.

rmdir -r directory

or

rm -rf directory

Use this with care, as its results can not be undone, and better if you never use it as root.

If you liked this article please share it.

powered by TinyLetter

If you want to contact me in any other way, please use the contact page.