Removing folder named ~

rm -R ./~

That will make it look for ~ in the current folder.


I've made silly mistakes with rm before so here are a few tips I've learnt over the years to try and keep you data safe from accidents:

  1. Use a graphical solution like Nautilus. Soft-delete it to the trash. Then when you know you haven't moved your $HOME into the trash (everything would have started crashing and looking funky), empty your trash.

  2. Move instead of delete. Rename the directory with mv, eg:

    mv ./\~ ./a-nice-sensible-directory-name
    

    Then delete it.

  3. If in doubt, use the -i flag when dealing with potential fubars. It will prompt you for every file removed and should let you very quickly know if something bad is going to happen.

    oli@bert:~/Desktop$ rm -rfi ./del/
    rm: descend into directory `./del'? y
    rm: remove regular file `./del/output2.pdf'?
    

Brilliant problem :)

You can delete the directory by escaping the tilde:

rm -rf \~

This works for all sorts of special characters.