2

I tried to remove a directory by using command rmdir but I got this answer:

The directory is not empty.

How to deal with such problems?

6

If you don't want to empty the directory first, you can use

rm -r

to recursively remove directories and their content.

Please note also that this is already explained in the documentation.

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

Since you are not an expert, I suggest that you read carefully that documentation page before using more the terminal, before you do some damage to your files!

3

If you want to remove an entire directory with everything in it, you can use rm -r like dadexix said and if you really want to make sure add the f for force

rm -rf

i Always do that and it Always works

1
  • 6
    Please be careful: not using -rf habitually has saved me several times from doing something disastrous. – Twinkles Jul 26 '16 at 11:21

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.