Thursday, December 15, 2011

remove delete file with a special character filename

For example, if your filename contains a dash character:
-2

# rm -- -2

The paired double dash is the delimiter for the command,
telling it to expect a 'dashed' argument.
Glance through the man page.

or

# rm ./-2

or

# rm '-2'

or

# touch tmp ; rm tmp -2

No comments: