Skip to main content

How do I remove or access a file with the name '-something' or containing another strange character ?

If your file starts with a minus, use the -- flag to rm; if your file is named -g, then your rm command would look like rm -- -g. As well, and especially if you have an unprintable character (output from ls looks like ?ile) you might try something like rm -i ./*ile which will also work for commands other than rm (grep for instance).

FAQ category:
Facilities