How to delete folder with strange name? [duplicate]

You can use -- to tell rm (and many other commands including many shell built-ins) not to interpret any further input as command parameters, so that -p can be interpreted correctly as an argument instead of an "unrecognised option"

rm -- -p

(This is also a good safety measure when globbing. You might have accidentally created a file called -rf...)


the proper way in this case is :

rm ./-p

-- may work with some commands, and fail with others. it is not bash that interprets it, but each command separately (and some may not recognise -- as the end of options) (especially true if you ever use non gnu commands... for example if you work on some other OSs).

Taking the habit of saying ./somefileorglob instead of just somefileorglob is a good habit, in general.