Ubuntu – Can not delete files containing special characters in the file name

command linespecial characters

I use Ubuntu 9.10 (Karmic) and I have a directory with many files, among them these two files:

./baer.jpg
./bär.jpg

I would like to delete bär.jpg but I can't.

If I type rm b and hit TAB, it shows me both files, if I append ä and hit TAB, nothing gets displayed.

What must be done in order to delete bär.jpg?

Deleting the parent folder is not a solution for me, as there are plenty of files in this directory that are used by a productive environment.

Best Answer

I just found out how to delete such files witch special characters:

  1. cd <directory with that file>

  2. ls -ali

  3. At the very left of the directory listing you see the ID of the inode of each file.

  4. Delete your file via inode ID:

    find . -inum <inode ID of your file> -exec rm -i {} \;

This worked fine for my issue. Hope this helps!