Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

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.

up vote 6 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

Not the answer you're looking for? Browse other questions tagged .