'Removing file with name of an argument [duplicate]

I was attempting to use the xxd command in bash, and used the -r argument, but forgot to add the in-file and out-file. I now have a useless file named -r and I cant remove it due to it being an argument for almost any command that I can think of that would be able to delete files.

Is there any other way for me to remove this file?



Solution 1:[1]

To remove a file whose name starts with a -, use:

rm -- -r

or

rm ./-r

-- is used to signify the end of command options.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Cubix48