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

This question already has an answer here:

I don't know how this happened, but I have a broken symlink in my home directory named *. I was just about to rm *, and then I had a facepalm moment. Should I rm \*? rm '*'? Something else? Backing up now...

share|improve this question

marked as duplicate by slhck May 22 '13 at 6:15

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.

@slhck A broken symlink is not a directory. You do not generally remove directories and files the same way. Here the '*' file is not under the file system root. There are more than one question in Dan Ross' one. Bottom line: I would not close that question. – jlliagre May 22 '13 at 18:04
@jlliagre The questions are not the same, but the answers are, and they boil down to escaping the glob, or quoting it, so anybody looking to remove such a file should find the answers helpful. – slhck May 22 '13 at 18:23
@slhck I agree there are many similarities and the other answers would have been helpful but they do not suggest using -i which I guess is the reason why I quickly got upvotes. – jlliagre May 22 '13 at 19:45
up vote 11 down vote accepted

Both rm \* and rm '*' would be fine, rm "*" too.

When in doubt, you should use the -i option for rm to prompt you before removing a file. For example this command will remove all files which name has only one character but only if you accept it:

rm -i ?
share|improve this answer
Thank you, this is not the sort of thing I like to experiment with. If I screwed up and had to restore from a backup, then the timestamps on all my files would be reset. Not the end of the world, but certainly not cool. Accepting in 49 seconds... – Dan Ross May 22 '13 at 5:09

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