2

I unintentionally saved a file with vim with an apostrophe and now when I attempt to use my cli to remove it doesn't allow me to do it because Linux can't recognize it.

eg

$ rm '
> 
Zanna
  • 69,223
  • 56
  • 216
  • 327
hmota
  • 121
  • 2

1 Answers1

7

It should be sufficient to double-quote it:

$ touch "'"
$ ls -l "'"
-rw-rw-r-- 1 steeldriver steeldriver 0 May 20 09:27 '
$ rm -i "'"
rm: remove regular empty file ''\'''? y

You could also use a backslash escape rm \'

steeldriver
  • 131,985
  • 21
  • 239
  • 326