Reputation: 23
How to remove a file(s) with strange name in ubuntu?
I used ssh-keygen, I think I copied the command line with the linebreak at the end and created two files with a very strange file name.
Try to delete
rm \'\'$\'r\'
But result:
rm: cannot remove ''\'''\''$'\''r'\''': No such file or directory
Upvotes: 2
Views: 3052
Reputation: 31
You can try to do an interactive rm
on any file starting with a non-alpha character:
$ ls [^A-z0-9]*
''$'\033''qq'$'\033'
$ rm -iv [^A-z0-9]*
rm: remove regular file ''$'\033''qq'$'\033'? y
removed ''$'\033''qq'$'\033'
Upvotes: 0
Reputation: 2326
$ rm -v -- #file
$ rm -v -- "#file"
$ rm -v ./#file
ls -li
output:
5133242 -rw-r--r-- 1 user #*%/file
then using find
$ find . -inum 5133242 -delete
Upvotes: 5