Sunday, June 7, 2015

Removing Special Character File Names in Linux

Accidentally a file was created with a name of "-rw-r--r--.err". I can't remove this file using our normal shell commands. At last lot of searches in Google I found a solution.

Find the inode of the file using the following command

$ ls –il


 9078727 is inode number.

Now Use find command to delete file by inode:
$ find . -inum 9078727 -exec rm -f {} \;

It will find that file and will remove it with force i.e remove without prompt.

No comments: