Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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.

share|improve this question
add comment

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.

1 Answer

up vote 5 down vote accepted

From man rm:

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

rm -- -foo
rm ./-foo
share|improve this answer
add comment

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