1

I accidentally created a file named '. Is there a simple way to delete this in bash? Unfortunately, there is already default behavior for rm '.

4
  • 1
    can you post the command that created it? that could also give a clue to delete it
    – Sundeep
    Oct 25, 2016 at 16:14
  • vim "'" was the command i used
    – heliotrope
    Oct 25, 2016 at 16:30
  • 1
    so rm "'" would have worked too ;)
    – Sundeep
    Oct 25, 2016 at 16:31
  • 1
    If you want to delete your question, you can do so yourself. You should see a "delete" button under it. However, please don't let a couple of downvotes get you down. We've all done silly things and we were all newbs before becoming experts. I think the downvoters didn't realize just how hard it is to search for special characters on search engines.
    – terdon
    Oct 25, 2016 at 16:52

1 Answer 1

5

Using double quotes around ':

rm "'"

Using single quote, and escaping:

rm \' 
4
  • rm \' also works
    – Joseph R.
    Oct 25, 2016 at 16:13
  • @JosephR. Actually was in the middle of incorporating this :)
    – heemayl
    Oct 25, 2016 at 16:15
  • 1
    ...and in the general case rm -i ? could help, since ? is a wildcard representing any a single character
    – roaima
    Oct 25, 2016 at 18:53
  • Just to have some other option: rm $'\'' also works. ;-)
    – user232326
    Oct 26, 2016 at 1:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .