home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

Unix Power ToolsUnix Power ToolsSearch this book

1.12. Filename Extensions

In Microsoft Windows and some other operating systems, filenames often have the form name.extension. For example, plain text files have extensions such as .txt. 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) make use of extensions to recognize the different types of files they work with. In addition, there are a number of conventions that users have 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-1 lists some of the filename extensions you might see and a brief description of the programs that recognize them.

Table 1-1. Filename extensions that programs expect




Archive file (library)


C program source file


FORTRAN program source file


FORTRAN program source file to preprocess


gzip ped file (Section 15.6)


C program header file

.html or .htm

HTML file for web servers


XHTML file for web servers


Object file (compiled and assembled code)


Assembly language code


Packed file


Compressed file (Section 15.6)

.1 to .8

Online manual (Section 2.1) source file


Emacs editor backup file (Section 19.4)

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

Table 1-2. Filename extensions for user's benefit




tar archive (Section 39.2)

.tar.gz or .tgz

gzip ped (Section 15.6) tar archive (Section 39.2)


Shell archive


Bourne shell script (Section 1.8)


C shell script


Text file containing troff's mm macros


Text file containing troff's ms macros


PostScript source file


Adobe Portable Document Format

--ML and TOR

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.