What character can be safely used for naming files on unix/linux?

Posted by Eric DANNIELOU on Server Fault See other posts from Server Fault or by Eric DANNIELOU
Published on 2012-09-27T10:32:31Z Indexed on 2012/09/27 15:39 UTC
Read the original article Hit count: 172

Before yesterday, I used only lower case letters, numbers, dot (.) and underscore(_) for directories and file naming.

Today I would like to start using more special characters. Which ones are safe (by safe I mean I will never have any problem)?

ps : I can't believe this question hasn't been asked already on this site, but I've searched for the word "naming" and read canonical questions without success (mosts are about computer names).

Edit #1 : (btw, I don't use upper case letters for file names. I don't remember why. But since a few month, I have production problems with upper case letters : Some OS do not support ascii!)

Here's what happened yesterday at work : As usual, I had to create a self signed SSL certificate. As usual, I used the name of the website for the files : www2.example.com.key www2.example.com.crt www2.example.com.csr.

Then comes the problem : Generate a wildcard self signed certificate. I did that and named the files example.com.key example.com.crt example.com.csr, which is misleading (it's a certificate for *.example.com).

I came back home, started putting some stars in apache configuration files filenames and see if it works (on a useless home computer, not even stagging).

Stars in file names really scares me : Some coworkers/vendors/... can do some script using rm find xarg that would lead to http://www.ucs.cam.ac.uk/support/unix-support/misc/horror, and already one answer talks about disaster.

Edit #2 :

Just figured that : does not need to be escaped. Anyone knows why it is not used in file names?

© Server Fault or respective owner

Related posts about linux

Related posts about unix