Remove invalid files by inode

This is for when you find files with invalid names that regular ‘rm’ won’t touch, eg.:

387090 drwx------ 3 root root 4.0K Aug 4 17:14 ''$'\033''[?25h'$'\033''[?7h'/

First you need to get the inode, using:

ls -il

this will show the inode at the left.

To remove the file, use the ‘find’ command. First we’ll see what ‘find’ can see:

find . -inum (inode number from before)

You should see just your invalid file. Remove it with:

find . -inum (inode number from before)  -exec rm -rf {} \;