How to delete a file that begins with a '-' ?
Hi,
actually this is not really a serious current problem of mine, but I would really like to know the proper way. Here's the situation: Yesterday I downloaded a file which name began with a dash ('-'). And after I got the feeling that I didn't want this file any more, I tried to delete it and recognized, that this was a much tougher task than I thought: The original name was quite long so let's abstract a little bit and assume it was called '-bla'. I think I'm quite familiar with linux command line and bash but this is going to drive me crazy. My first try was: $ rm -bla of course this didn't work and I recognized it yet before I pressed enter. And then the trouble began..., I tried all of these: Code:
$ rm "-bla" -flesym |
From this page:
Quote:
|
Ah yes, of course! -Thank you!
|
Another method (just for the sake of completeness) is to specify give the argument "--" before the name of the file. This tells the shell that at this point, all arguments have been given, so it stops parsing dashes as argument switches (something along these lines, it may not be technically accurate). For example, you could remove a file called -foo with
Code:
rm -- -foo Code:
rm ./-foo |
All times are GMT -5. The time now is 07:03 PM. |