Server Fault is a question and answer site for system and network administrators. 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 have this file in my linux machine:


I try to delete this file but I cant as all see here:

what need to add to rm in order to remove this file ?

rm "----------9976723563nneh4_-----"
rm: illegal option -- --------9976723563nneh4_-----
usage: rm [-fiRr] file ...


rm '----------9976723563nneh4_-----'
rm: illegal option -- --------9976723563nneh4_-----
usage: rm [-fiRr] file ...
share|improve this question

marked as duplicate by Michael Hampton, voretaq7 May 2 '13 at 17:56

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 my point it will better to show this question , because rm is different from cd and – yael May 2 '13 at 15:08
up vote 7 down vote accepted
rm -- ----------9976723563nneh4_-----

You need -- in order to tell rm (and more or less all other GNU software) that all following parameters are file names even when beginning with "-". Otherwise (and in your case) the file name is confused with options. Another possibility is

rm ./----------9976723563nneh4_-----

Edit 1

Calling this trivial answer a "great solution" makes me feel obliged to take it to a higher level. The basic problem cannot be solved "better" but you can try to get used to always making -- an argument. And some shell code (replacing rm by a shell function) can help you with this:

rm () {
  local args sep_found=no
  while [ $# -gt 0 ]; do
    if [ "--" = "$1" ]; then
  if [ "yes" = "$sep_found" ]; then
    command rm "${args[@]}"
    echo "WARNING: rm called without '--' seperator."
    echo "Please correct the command; aborting."

You would put this in e.g. ~/.bashrc.

share|improve this answer
GREAT SOLUTION _ WOW _ -:) – yael May 2 '13 at 15:28
@yael See the edit. – Hauke Laging May 2 '13 at 16:35

From the manual page for rm:

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

rm -- -foo

rm ./-foo

so to remove your file, try rm -- ----------9976723563nneh4_-----

share|improve this answer

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