9

Which characters are invalid for an ext3 filename? I imagine that at least / is an invalid character and probably \0. Is there an official list somewhere?

I'm not exactly sure where to look for this information, so please tell me where you found it.

1

2 Answers 2

9

Just those two.

From the wikipedia page on ext3:

Allowed characters in filenames - All bytes except NULL and '/'

1
  • Ah, I didn't see the stats at the side of the wikipedia page. Thanks!
    – User1
    Dec 1, 2010 at 21:26
3

/ seems to be allowed, at least on ext3 (supposedly in all, ext, ext2 & ext3 at least, likely also ext4) - just try this:

f='test/file'; echo "Test: '${f}'"
for c in touch ll rm ;do
eval "${c} '${f}'"
done

That will create "test/file", surprised me too... It will create it, show it with ls command and finally remove it with rm

You can type it on one line in bash:

$ f='test/file';for c in touch ll rm ;do eval "${c} '${f}'";done

So / seems to be (bizerrely) allowed in filenames - probably many tools can get confused with such though...

4
  • Cool trick, though probably ill-advised on production systems :-)
    – voretaq7
    Oct 19, 2012 at 18:58
  • Errr… do you have a directory called 'test'? That'll make a difference: touch: cannot touch 'test/file': No such file or directory
    – MikeyB
    Oct 19, 2012 at 19:35
  • Though useful as a joke to pull on one's assistants.
    – Magellan
    Oct 19, 2012 at 20:05
  • No just managed to create a file named "test/file" - would be interesting to try it with existing directory named test... It might not even give trouble, after all, the / at the end of directory name isn't really part of it's name... So I could imagine them actually working together... It'll look confusing though... Or did you mean you actually tried it? :)
    – robsku
    Jul 22, 2014 at 13:10

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.