Полезная информация

UNIX Power Tools

UNIX Power ToolsSearch this book
Previous: 1.16 Wildcards Chapter 1
Next: 1.18 Who Handles Wildcards?

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
.aArchive file (library)
.cC program source file (52.8)
.fFORTRAN program source file
.FFORTRAN program source file to preprocess
.gzgzipped file (24.7)
.hC program header file (52.8)
.htmlHTML file for World Wide Web servers
.oObject file (compiled and assembled code) (52.8)
.sAssembly language code
.zPacked file
.ZCompressed file (24.7)
.1 to .8Online 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
.txtASCII text file
.tartar archive (19.5)
.sharShell archive (19.2)
.shBourne shell script (1.5)
.cshC shell script (47.2)
.mmText file containing troff's mm macros (43.14)
.msText file containing troff's ms macros (43.14)
.psPostScript source file


Previous: 1.16 Wildcards UNIX Power ToolsNext: 1.18 Who Handles Wildcards?
1.16 Wildcards Book Index1.18 Who Handles Wildcards?

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System