Removing file with name of an argument

Viewed 24

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?

1 Answers

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

rm -- -r

or

rm ./-r

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

Related