Gossamer Forum
Home : General : Perl Programming :

Legal characters in unix filenames

Quote Reply
Legal characters in unix filenames
Anyone know where I can find a complete list of legal characters for unix filenames?

I know naturaly that A..z and 0..9 are acceptable.

Can any of these be used?
`~!@#$%^&*()_-+=\|]}[{'";:,<.>/?
Quote Reply
Re: Legal characters in unix filenames In reply to
I have seen Unix file names with the following extra symbols:

"_" Underscores
"." Periods
"," Commas
"&" Ampersands
"-" Hyphens

You absolutely cannot use the following:
"/" Forward slash, used to handle directories.
"\" Back slash, used to escape items.
""" Double quotes, used to package prompt items.
"'" Single right quote, used to package prompt items.
";" Semi-colon, used to separate line entries.
"*" Asterisk, a wild card identifier.
"?" Question, a wild card identifier.
"<>" Greater than, less than. Used for redirection.
"|" Pipes, used for piping.
"@" At symbol, used by the shell.
"+" Plus sign, may be misinterpreted by the shell to concantate items.
"=" Equals, may be misinterpreted by the shell as an equivalency.

So that leaves the following:
"~" Tilde, has the potential to confuse a web server.
"!" Bang, exclamation, may be misinterpreted by the shell.
"#" Pound sign, may be misinterpreted by the shell.
"$" Dollar sign, may be misinterpreted by the shell.
"%" Percent, may be misinterpreted by the shell.
"^" Caret, may be misinterpreted by the shell.
"()" Parenthesis, may be misinterpreted by the shell.
"[]" Brackets, may be misinterpreted by the shell.
"{}" Braces, may be misinterpreted by the shell.

Did I miss any, if so, don't use em.


------------------
Fred Hirsch
Web Consultant & Programmer
Quote Reply
Re: Legal characters in unix filenames In reply to
If you're trying to find out what characters are legal on the server that you're using, the best bet is to ask the administrator for the system (assuming you're not the one running the server). My local Unix administrator has disabled a number of different possible variations of file names to keep people from potentially screwing up one of his servers by uploading a file with spaces or something like that.