In Bash, file starts with a "-"

An application created a directory called "-123456" in my /tmp directory.

In Bash, rm -rf * returns: bash: cd: -7: invalid option

rm -rf "-123456" Same thing.

Help?


Solution 1:

Use "--" to end your list of arguments. Thus: rm -rf -- -123456

Solution 2:

Have you tried rm -rf ./-123456?

Edit: Works for me

# ls -l
total 1
drwxr-xr-x 2 root root 4096 Mar 29 20:48 -test
# rm -rf ./-test
# ls -l
total 0