I don't know how, but I created a file with an empty file name, I doubt there was a whitespace there (I'll explain why at the end):

chaouche@karabeela /mnt/ubuntu/storage $ ls
total 352K
drwx------  3 chaouche chaouche 4.0K Feb 12 11:00
drwxr-xr-x  4 chaouche chaouche 4.0K Apr 14 23:13 AUDIO
drwxr-xr-x  5 chaouche chaouche 4.0K Jul 20 22:25 BACKUPS
-rw-r--r--  1 chaouche chaouche 310K Jun 15 13:00 cv_yassine_chaouche_2012.pdf
drwxr-xr-x  2 chaouche chaouche 4.0K Jun 10 22:16 Mageia-3-i586-DVD
drwxr-xr-x  5 chaouche     1001 4.0K Oct 12  2012 MUSIQUE
drwxr-xr-x 15 chaouche chaouche 4.0K Oct 27  2012 PARISVIII
drwxr-xr-x  6 chaouche chaouche 4.0K Jun 12 18:33 SABAYON
drwxr-xr-x  5 chaouche chaouche 4.0K Jun 15 13:23 SIFTECH
drwxr-xr-x  5 chaouche chaouche 4.0K Feb  6 15:11 TOILES
drwxr-xr-x  4 chaouche chaouche 4.0K Jul 17 17:21 VIDEOS
chaouche@karabeela /mnt/ubuntu/storage $

I asked on #linux how to remove the file and a person suggested I moved all other files away then use the tab completion, which gave a very interesting behaviour :

# with tab completion
chaouche@karabeela /mnt/ubuntu/storage $ ls /
total 45M
-rwxr-xr-x  1 chaouche chaouche  34M Jan 16  2013 inkscape-0.48.4-1-win32.exe
-rwxr-xr-x  1 chaouche chaouche 8.6M Feb  4 11:42 mypaint-1.0.0-win32-installer.exe
-rwxr-xr-x  1 chaouche chaouche 2.7M Jan 17  2013 pdftkb_setup.exe

# without tab completion, wrote "/" by hand
chaouche@karabeela /mnt/ubuntu/storage $ ls /
total 212K
-rw-r--r--   1 root root    0 Apr 15  2012 1
drwxr-xr-x   2 root root 4.0K Dec  9  2012 bin
drwxr-xr-x   3 root root 4.0K Jun 15 12:10 boot
-rw-------   1 root root  74K Jul  1  2011 dead.letter
drwxr-xr-x  19 root root 4.2K Jul 20 20:14 dev
drwxr-xr-x 117 root root  12K Jul 20 21:30 etc
drwxr-xr-x   4 root root 4.0K Jun 12 18:40 home
drwxr-xr-x   2 root root 4.0K Jun  8  2011 initrd
drwxr-xr-x  20 root root  12K Dec  9  2012 lib
drwx------   2 root root  16K Jun  7  2011 lost+found
drwxr-xr-x   4 root root 4.0K Jul  3 01:56 media
drwxr-xr-x   9 root root 4.0K Apr 15 00:06 mnt
drwxr-xr-x   8 root root 4.0K Jun 30 23:19 opt
dr-xr-xr-x 198 root root    0 Jun 15 13:10 proc
drwxr-x---  28 root root 4.0K Jul 20 21:42 root
drwxr-xr-x   2 root root  12K Dec  9  2012 sbin
drwxr-xr-x   2 root root 4.0K Apr  3  2011 srv
drwxr-xr-x  12 root root    0 Jun 15 13:10 sys
-rw-r--r--   1 root root    0 Jun 12 18:40 thisismageia
drwxrwxrwt  69 root root  36K Jul 20 22:04 tmp
drwxr-xr-x  14 root root 4.0K Nov  6  2011 usr
drwxr-xr-x  18 root root 4.0K Jul  2  2011 var
chaouche@karabeela /mnt/ubuntu/storage $

If there was a whitespace in the filename it would have been replaced by \" " when I hit the tab key, but it didn't.

  • 5
    It's a directory not a file apparently it holds three files.
    – Bananguin
    Jul 20, 2013 at 22:06
  • 2
    Assuming you have still kept the directory where you moved everything away but the empty file, what happens when do file *?
    – Joseph R.
    Jul 20, 2013 at 22:26
  • No unfortunately I have renamed the file with the mv command.
    – ychaouche
    Jul 21, 2013 at 1:45
  • 4
    Possible duplicate of Files with empty names Jun 5, 2017 at 9:38
  • 2
    This question is not a duplicate of that one.  This question is about practical techniques for dealing with an accidentally-created file (or directory) who name contains no printing characters.  That other question is a theoretical, hypothetical, rambling discussion of ways that you might create such a file if you wanted to, and says nothing of dealing with the aftermath. Jun 5, 2017 at 19:44

2 Answers 2


It is not possible to have a file with an empty name. What you have is a file whose name entirely consists of blank or non-printable characters.

To see exactly what the file name is, run LC_CTYPE=C ls -b. This replaces all blank or non-printable characters by octal escapes. For example, a file whose name is a single zero-width space would be listed as \342\200\213.

You can isolate this file with a glob that excludes files with a nice name. For example, you could try listing the files whose name doesn't begin with a letter.

chaouche@karabeela /mnt/ubuntu/storage $ ls -d [^A-Za-z]*

Don't forget the option -d, so that ls lists the directory itself and not its contents.

You should rename the file to have a reasonable name. You can rely on your shell's completion, or use a glob that matches only this file.

mv [^A-Za-z]* windows-programs

It could be a directory with only spaces or non-printing characters in the name. Also, it appears it only has one entry in it, other than '.' and '..', which is why you see the '3' in the second column of the output of your first command. You could always use stat to print out the name of the directory, with: stat -f "'%N'" *. If it's unprintable, you might have to pipe it into cat -v or od -c to see what it actually is.

To remove it, you will probably have to run rmdir -- 'dirname' (replace 'dirname' with the name of the directory. You might need to use globs if it has unprintable names in it), although as I said before, it appears to have contents so you'll have to descend into that directory with cd -- 'dirname' and examine its contents.

I would suggest you avoid using rm -rf at all costs, since the directory naming issue is easy to mess up.

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.