[Chapter 1] 1.17 Filename Extensions
Author: Jerry Peek, Tim O'Reilly & Mike Loukides
Date: 1998-08-04T21:31:18Z

#

| Chapter 1 Introduction |

## 1.17 Filename Extensions

In DOS and some other file systems, filenames often have the form `name`.`extension`. For example, Lotus 1-2-3 files have extensions such as .wk1. The operating system treats the extension as separate from the filename and has rules about how long it must be, and so forth.

UNIX doesn't have any special rules about extensions. The dot has no special meaning as a separator, and extensions can be any length. However, a number of programs (especially compilers (52.8)) do make use of one-character extensions to recognize some of the different types of files they work with. In addition, there are a number of conventions that users have sometimes adopted to make clear the contents of their files. (For example, you might name a text file containing some design notes notes.txt.)

Table 1.2 lists some of the extensions you might see to filenames, and a brief description of the programs that recognize them.

Table 1.2: Filename Extensions That Programs Expect
Extension | Description
--- | ---
.a | Archive file (library)
.c | C program source file (52.8)
.f | FORTRAN program source file
.F | FORTRAN program source file to preprocess
.gz | gzipped file (24.7)
.h | C program header file (52.8)
.html | HTML file for World Wide Web servers
.o | Object file (compiled and assembled code) (52.8)
.s | Assembly language code
.z | Packed file
.Z | Compressed file (24.7)
.1 to .8 | Online manual (50.1)source file

In Table 1.3 are some extensions that are often used by users to signal the contents of a file, but are not actually recognized by the programs themselves.

Table 1.3: Filename Extensions for User's Benefit
Extension | Description
--- | ---
.txt | ASCII text file
.tar | tar archive (19.5)
.shar | Shell archive (19.2)
.sh | Bourne shell script (1.5)
.csh | C shell script (47.2)
.mm | Text file containing troff's mm macros (43.14)
.ms | Text file containing troff's ms macros (43.14)
.ps | PostScript source file

- ML, TOR

1.16 Wildcards |  | 1.18 Who Handles Wildcards?