Celeb Glow
news | March 01, 2026

Need to delete a file I accidentally labeled in quotes in Linux [duplicate]

I have a file which I wrote and not thinking put the actual filename in single quotes like this:

'filename'

When I try to remove it using rm -f 'filename' it does not recognize that it is there I get the error:

rm: cannot remove 'filename'. No such file or directory.

Any suggestions?

1

2 Answers

Quote the quotes.

rm "'filename'"
1

Another option (in addition to @IgnacioVasquezAbrams's) is to escape the '

rm \'filename\'

enter image description here