How do I delete a file named '--something' (starting with double slash)?

Asked by schnollk

I've got a file named '--something' (without quotes) that I cannot delete with normal syntax since it's taken as command line argument because of the double slash.
$ rm '--something'
rm: unrecognized option `--something'
Try `rm --help' for more information.

Any suggestions? Thanks allready.

Question information

Language:
English Edit question
Status:
Solved
For:
Ubuntu Edit question
Assignee:
No assignee Edit question
Solved by:
Sannny
Solved:
Last query:
Last reply:
Revision history for this message
Best Sannny (samuel-owee) said :
#1

rm -- --somthing

Revision history for this message
markino (marco-crosio) said :
#2

try with

rm "./--something"

:))

Revision history for this message
Simos Xenitellis  (simosx) said :
#3

Both solutions work.

As Sanny describes, in command line programs, the option "--" signifies the end of options, so whatever comes next should be taken literally.

Revision history for this message
schnollk (schnollk) said :
#4

Thanks folks. And once again I learned something interesting!

Revision history for this message
schnollk (schnollk) said :
#5

Thanks Sannny, that solved my question.