Saturday, December 4, 2010

How to remove files starting with - minus in the filename

There might be several ways to remove files starting with first character as - minus. But i am providing 3 solutions below.

1. $ rm ./-filename

2. $ rm -- -filename

3. Find the inode number by using ls -i and then use the below command
find . -inum 45678 -exec rm {} \;