10

Possible Duplicate:
Unable to remove a special named files in terminal

I feel silly asking, but how can I delete a file in linux named --preserve-permissions?

I tried:

rm "--preserve-permissions"

and

rm "\-\-preserve-permissions"

Neither works. Thanks.

Community
  • 1
  • 1
Justin
  • 42,716
  • 77
  • 201
  • 296

3 Answers3

20

There are several techniques, but the most straightforward for this kind of filename is:

rm ./--preserve-permissions

For filenames with unprintable or hard-to-decipher characters, use

rm -i *

This prompts with each filename and waits for a y or n whether to delete the file (interactive).

wallyk
  • 56,922
  • 16
  • 83
  • 148
13

Use:

rm -- --preserve-permissions

The -- by itself means "switches end here, everything that follows is a file name".

Greg Hewgill
  • 951,095
  • 183
  • 1,149
  • 1,285
2

You can use inode number instead of the filename. See http://www.cyberciti.biz/tips/delete-remove-files-with-inode-number.html

Maxim Egorushkin
  • 131,725
  • 17
  • 180
  • 271