I don't know how I've done this but I've created somehow a folder named "-p". Now I'm trying to delete it but my buntu is thinking I'm passing -p as a paremeter.
What can I do?
Ubuntu Server 15.
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It only takes a minute to sign up.Sign up to join this community
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
the proper way in this case is :
-- 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.