Question

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.

Was it helpful?

Solution

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).

OTHER TIPS

Use:

rm -- --preserve-permissions

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

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top