I just noticed that in the /root directory, there exists a directory with its name starting with a dash: -p in my FreeBSD box.
root@raspbsd:~ # ls -l
total 144
drwxr-xr-x 2 root wheel 512 May 5 18:26 -p
drwxr-xr-x 2 root wheel 512 May 5 20:45 .byobu
drwxr-xr-x 3 root wheel 512 May 5 20:45 .cache
-rw-r--r-- 2 root wheel 959 Jan 23 00:59 .cshrc
As much as I wanted to get rid of it, I was curious to find out what’s inside that directory.
root@raspbsd:~ # cd -p/
Usage: cd [-plvn][-|...
That didn’t work. After a short while of trying many things, I figured out 2 ways to do it.
root@raspbsd:~ # cd \-p
root@raspbsd:~/-p #
Another way (1) is to add ‘./’ in front of it:
root@raspbsd:~ # cd ./-p
root@raspbsd:~/-p #
Finally, after confirming that the ‘-p’ hold no file, it can be deleted as:
# rmdir ./-p
Notice that, # rmdir \-p does not work though. I should have put a disclaimer on the top. I only tested this on FreeBSD, but it should also work on Linux. If you decide to follow my instruction to remove any files on your system, do it cautiously. I will not be responsible for your action ^_^.
Reference: (1) http://www.electrictoolbox.com/delete-file-starting-with-dash-hyphen/