I was under the impression that the only character not allowed in file names was /, but I don't seem to be able to create a file whose name contains characters such as *, \, ", :, |, < or > either. For instance,

"I'm writing a shell script that requires the user to type a file name and I would like to make sure the name doesn't have any invalid characters. Is there a list somewhere?" Just try to create the file, and fail cleanly and tell them if it didn't work. There are other reasons file creation could fail (creating under a nonexistent directory, for example), and trying to check for all of them in advance just opens you to a race condition.
–
Random832Oct 1 '12 at 15:14

2 Answers
2

You can easily make a file with '.', '\' and other funky things in it. Think "unicode file names", which contain all kinds of weird byte values.

Naturally, you can't have duplicate file names in the same directory, so files named "." and ".." can't usually be made by a mere user: the filesystem part of the kernel creates them when a directory gets created.

Also note that most filesystems have a limit on the length of a file name, and you can't create a file whose name is the empty string.