Possible Duplicate:
Unix: Files starting with a dash, -

Somehow I ended up with a file named "-r". How do I remove it? rm -r doesn't work. I tried 'rm -i `ls -a`' to step through the file names, but it didn't prompt me to delete this one.

Edit A very hacky approach was to use python's os.unlink function. That worked, but I'm curious to hear other ways.

marked as duplicate by quack quixote Jun 22 '10 at 19:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.


From man rm:

To remove a file whose name starts with a '-', for example '-foo', use one of these commands:

rm -- -foo
rm ./-foo

Not the answer you're looking for? Browse other questions tagged or ask your own question.