[Chapter 4] 4.2 File and Directory Names
Author: Jerry Peek, Grace Todino & John Strang
Date: 1998-08-03T20:51:18Z

#

| Chapter 4 File Management |

## 4.2 File and Directory Names

As Chapter 3, Your UNIX Account , explained, both files and directories are identified by their names. A directory is really just a special kind of file, so the rules for naming directories are the same as the rules for naming files.

Filenames may contain any character except `/`, which is reserved as the separator between files and directories in a pathname. Filenames are usually made of upper- and lowercase letters, numbers, "." (dot), and "_" (underscore). Other characters (including spaces) are legal in a filename - but they can be hard to use because the shell gives them special meanings. So we recommend using only letters, numbers, dot, and underscore characters.

Unlike some operating systems, UNIX doesn't require a dot (`.`) in a filename; in fact, you can use as many as you want. For instance, the filenames pizza and this.is.a.mess are both legal.

Some UNIX systems limit filenames to 14 characters. Most newer systems allow much longer filenames.

A filename must be unique inside its directory, but other directories may have files with the same names. For example, you may have the files called chap1 and chap2 in the directory /users/carol/work and also have files with the same names in /users/carol/play.

4.1 Methods of Creating Files |  | 4.3 File and Directory Wildcards