Skip to content
Home » Unix » How to Remove Files with Names Containing Special Characters

How to Remove Files with Names Containing Special Characters

Here I demonstrate how to remove files with names containing special characters:

$ echo "Hello" > "177"
$ ls -il
total 2
    234981 -rw-r--r--   1 oracle    dba           6 Nov 22 19:20 177

Let's try to use rm to remove it.

$ rm 177
177: No such file or directory

It did not work in our first attempt, so I think we should take care it as a special name by double or single quotes.

$ rm "177"
$ rm '177'

It should be successful. If not, the last resort is to use rm in find command by specifying inode number like this.

$ find . -inum 234981 -exec rm {} ;

Leave a Reply

Your email address will not be published. Required fields are marked *