Need to delete a file I accidentally labeled in quotes in Linux

5

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?

user255059

Posted 2013-09-17T17:00:35.963

Reputation:

Question was closed 2013-12-20T14:43:20.017

Answers

9

Quote the quotes.

rm "'filename'"

Ignacio Vazquez-Abrams

Posted 2013-09-17T17:00:35.963

Reputation: 100 516

3

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

rm \'filename\'

enter image description here

nerdwaller

Posted 2013-09-17T17:00:35.963

Reputation: 13 366