Like all operating systems, UNIX files have names: words (sequences of characters, whatever) that let you identify a file. Older versions of UNIX had some restrictions on the length of a filename (14 characters), but modern versions have removed these restrictions for all practical purposes. Sooner or later you will run into a limit, but if so, you are probably being unnecessarily verbose.
Technically, a filename can be made from almost any group of
characters (including non-printing characters) except a slash
/). However, you should avoid filenames containing most
punctuation marks and all non-printing characters. These will usually
be a pain.
To be safe, limit your filenames to the following characters:
Uppercase and lowercase characters. UNIX is always case-sensitive. That is, uppercase and lowercase letters are always different (unlike DOS and VAX/VMS, which consider uppercase and lowercase letters the same). Therefore, myfile and Myfile are different files. It is usually a bad idea to have files whose names differ only in their capitalization, but that's your decision.
Periods are used by some programs (such as the C
compiler) to separate filenames from
Extensions are used by these programs
to recognize the type of file to be processed, but they are not
treated specially by the shell, the kernel, or other UNIX programs.
Filenames that begin with a period are treated specially by the
.*). The ls command, which lists your files, ignores
files whose names begin with a period unless you give it a special
Special configuration files are often
"hidden" in directories by beginning their names with a
Certain other punctuation.
About the only other punctuation mark
that is always safe is the comma (
,)-although it isn't part of the
POSIX-portable character set. The other punctuation marks
may have special meanings in one situation or another. Stay away from
them, or you will create filenames that are inconvenient to work with.
Some things to be aware of:
UNIX does not have any concept of a file version. There are some that implement their own notion of a version, but there is nothing analogous to VAX/VMS's version number. If you are editing a file, don't count on UNIX to save your previous versions - you can make though, if you want to; the GNU Emacs editor also .
Once you delete a file in UNIX, . You can't get it back without restoring it from a tape. Be careful when you delete files. Later, we'll show you that will give you a "grace period" between the time you delete a file and the time it actually disappears.