The problem:
So a couple of days ago this happened:
% ls -lh |grep 033 -rw-r--r-- 1 jsvd users 71K May 25 15:05 `\033
Yeah.. “What the hell is that?” was my first thought. The second was “How do I delete this?”
I tried the usual tricks to delete files with weird characters, to no avail:
% rm ./`\033 `bquote> % rm "\`\\033" rm: cannot remove ‘`\\033’: No such file or directory % rm "\`\033" rm: cannot remove ‘`\\033’: No such file or directory % rm "*033" rm: cannot remove ‘*033’: No such file or directory
The solution:
The only way I was able to delete the file was through the inode:
% ls -lhi |grep 033 50105 -rw-r--r-- 1 jsvd users 71K May 25 15:05 `\033 %
OK so now that I have the inode of the misbehaved file, let’s confirm we can find it by the inode:
% find -inum 50105 ./`? %
Ermm..yep that’s it. Just pipe it to rm and be done with it:
% find -inum 50105 | xargs rm %
Is it gone?
% find -inum 50105 %
Success!
I usually employ Midnight Commander for these weird files