Somehow a program created a file with a broken filename which cannot be deleted anymore. Any attempt to delete the file results in "No such file or directory" as if the file isn't there.

The problem seems to be a control character ASCII 2 in the filename.

$ ls

$ ls | xxd
00000000: 3f3f 5b3f 3f02 3f3f d8a9 3f58 0a         ??[??.??..?X.

# Typing '?' and letting the bash complete the filename
$ rm \?\?\[\?\?^B\?\?ة\?X 
rm: das Entfernen von '??[??'$'\002''??ة?X' ist nicht möglich: Datei oder Verzeichnis nicht gefunden

$ rm *
rm: das Entfernen von '??[??'$'\002''??ة?X' ist nicht möglich: Datei oder Verzeichnis nicht gefunden

$ ls -i
2532 ??[?????ة?X
$ find -inum 2532 -delete
find: ‘./??[??\002??ة?X’ kann nicht gelöscht werden.: Datei oder Verzeichnis nicht gefunden

I tried to run fsck after reboot but the file is still there.

$ zcat /var/log/upstart/mountall.log.1.gz
fsck von util-linux 2.25.1
/dev/sdc3: sauber, 544937/6815744 Dateien, 21618552/27242752 Blöcke

No indication there was a problem. ("sauber" = clean)

I even tried to wrote my own deletion program which failed as well as the rm command:

$ cat fix.c
#include <stdio.h>
#include <errno.h>

int main() {
    char filename[20];
    sprintf(filename, "%c%c%c%c%c%c%c%c%c%c%c%c", 0x3f,0x3f,0x5b,0x3f,0x3f,0x02,0x3f,0x3f,0xd8,0xa9,0x3f,0x58);
    printf("filename = %s\n", filename);

    int result = remove(filename);
    printf("result = %d\n", result);
    printf("errno = %d\n", errno);
    return 0;

$ gcc -o fix fix.c && ./fix
filename = ??[????ة?X
result = -1
errno = 2
Error: No such file or directory

I found similar questions the answers there don't work for me:

Other information:

$ mount | grep " / "
/dev/sdc3 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)

$ uname -a
Linux hera 4.13.0-16-generic #19-Ubuntu SMP Wed Oct 11 18:35:14 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

$ cat /etc/issue
Ubuntu 17.10 \n \l

Is there a way to get rid of this file?

  • First, use ls -b to find out what it's really called. Nov 4, 2017 at 22:21
  • Why would rm * be a good idea? :p
    – jesse_b
    Nov 4, 2017 at 22:23
  • fsck.ext4 -f, and if that does not help, try your luck with debugfs Nov 4, 2017 at 22:29
  • @Jesse_b plan was: when you cannot name the file, tell rm to just delete everything. The folder was otherwise empty, because you can move other files out of there.
    – theHacker
    Nov 5, 2017 at 10:08

2 Answers 2


There are a bunch of options for deleting files with non-ascii filenames.

I was able to create and delete a file with the filename under discussion by using ANSI C quoting:

# Create the offending file
touch $'\x3f\x3f\x5b\x3f\x3f\x02\x3f\x3f\xd8\xa9\x3f\x58\x0a'

# Verify that the file was created
ls -lib

# Remove the offending file
rm $'\x3f\x3f\x5b\x3f\x3f\x02\x3f\x3f\xd8\xa9\x3f\x58\x0a'

Take a look at this post:

Here's a command taken from that post that should delete all files in the current directory whose names contain non-ascii characters:

LC_ALL=C find . -maxdepth 0 -name '*[! -~]*' -delete

You can modify the glob pattern or use a regular expression in order to narrow down the matches.

Here's another relevant post:

There's a suggestion there to try deleting by inode. First run ls -lib to find the inode of the offending file, and then run the following command to delete it:

find . -maxdepth 1 -inum ${INODE_NUM} -delete

You might also find the following article to be generally useful:


Always double check on which partition your files are ;-)

Turns out the bad file was not on my root partition but on a cifs mount. To get rid of the file the solution was just like there:

Delete the file on the target maschine. There the rm command works normally.

  • I think you're supposed to accept this solution if it solved your problem. Otherwise this question will remain open.
    – igal
    Nov 5, 2017 at 19:30
  • @igal: thx for the reminder. Accepting your own answer was not possible directly after writing it. There was an error message telling you had to wait a few days.
    – theHacker
    Nov 7, 2017 at 21:53
  • Yeah, sorry about that. I forgot about the delay. Anyway, glad you got it sorted out.
    – igal
    Nov 7, 2017 at 21:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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