Delete the file on Linux that contains a double dash

Possible duplicate:
Cannot delete special named files in terminal

It seems silly to me to ask, but how can I delete a file in linux named --preserve-permissions ?

I tried:

 rm "--preserve-permissions" and rm "\-\-preserve-permissions" 

Nothing works. Thanks.

+6
source share
3 answers

There are several methods, but the simplest for this type of file is:

 rm ./--preserve-permissions 

For file names that are not printable or hard to decrypt characters, use

 rm -i * 

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

+11
source

Using:

 rm -- --preserve-permissions 

-- in itself means that "the keys end here, all that follows is the name of the file."

+11
source

Instead of a file name, you can use the inode number. See http://www.cyberciti.biz/tips/delete-remove-files-with-inode-number.html

+2
source

All Articles