Tell me more ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 me 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.

share|improve this question
Try using midnight commander. I think you can install it with sudo apt get install mc. After that, run it with mc and us it to delete your file. – Milan Todorovic Dec 27 '12 at 8:31
Thanks, but I was looking for a command-line solution. – bzero Dec 27 '12 at 8:36
I thought so, that's why I put this in comments :) – Milan Todorovic Dec 27 '12 at 8:41

2 Answers

up vote 2 down vote accepted

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!

share|improve this answer

Well, you can try using matching via grep to delete the file if it's a single problematic file.

neal@dsadsa:~$ touch junk_ä_deleteme
neal@dsadsa:~$ ls | grep junk | grep deleteme | xargs rm

Here, I am creating a file named junk_ä_deleteme. I delete it afterward by matching characters before ("junk") and after ("deleteme") the funny symbol. This approach isn't very good, but if it is a single file, it might work.

Perhaps a better solution would be to form a regex to match your file, and then pipe that filename to rm.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.