I accidentally created a folder named '-p' using the mkdir command on my Ubuntu 24. Now, I can't seem to delete it. The name appears as '–p', and when I try to remove it, I get stuck because of the leading dash. Any ideas on how to get rid of this folder?
3 Answers
Another option is to use `rmdir -- -p`. The double dash tells the command that everything following it is a folder name, not an option. If that fails, you might have some hidden characters causing issues. Use tab completion to check if the name expands correctly.
If all else fails, booting from a live USB with a lightweight Linux distro like Puppy Linux is a good way to access your files and delete the folder directly.
If you can't remove it with the usual commands, check the inode number with `ls -i` and then try deleting it using the inode with `find . -inum -exec rm {} ;`. This can bypass naming issues.

Related Questions
Can't Load PhpMyadmin On After Server Update
Redirect www to non-www in Apache Conf
How To Check If Your SSL Cert Is SHA 1
Windows TrackPad Gestures