5
I have been creating odd-named files every once in a while, e.g.
$ls -rthl
$-rw-r--r-- 1 shamil hep 290 Aug 13 11:58 -rf
And interestingly it is impossible to remove this file with
rm -f -rf
I know I need to escape the special symbols like "-", so the issue is clear. And I used to know the solution, but have since forgotten.
How do I properly delete it?
I have tried things like this
rm -f \-rf
but to no avail.
Even more discussion at How do I delete a file whose name begins with “-” (hyphen a.k.a. dash or minus)? (on U&L).
– Scott – 2015-03-26T04:00:26.307Ty. Somehow I wasn't able to find it. – Chikipowpow – 2013-12-17T20:25:53.947
2Probably best to just haul out the big guns
python -c 'import os; os.remove("-rf")'
– u2EF1 – 2013-12-17T20:26:11.837@U2EF1 nice. I used to use that hack before learning the
--
:) Sadly, not every distribution has Python, so it is also not very portable. – Paulo Bu – 2013-12-17T20:28:19.673