Unix File Extension Conventions

Some other operating systems have filenames of the form of a base name, a dot, and a one- to three-character file type or file extension. These extensions serve an important purpose: they indicate that the file contents belong to a particular class of data. For example, an extension pas could mean that the file contains Pascal source code, and exe would identify a binary executable program.

There is no guarantee that file contents are reflected in their file extensions, but most users find them a useful custom, and follow convention.

Unix too has a substantial number of common file extensions, but Unix filenames are not forced to have at most one dot. Sometimes, the extensions are merely conventional (e.g., for most scripting languages). However, compilers generally require particular extensions, and use the base name (after stripping the extension) to form the names of other related files. Some of the more common extensions are shown in Table B-1.

Table B-1. Common Unix file extensions

Extension

Contents

1

Digit one. Manual page for section 1 (user commands)

a

Library archive file

awk

awk language source file

bz2

File compressed by bzip2

c

C language source file

cc C cpp cxx

C++ language source file

eps ps

PostScript page-description language source file

f

Fortran 77 language source file

gz

File compressed by gzip

f90

Fortran 90/95/200x language source file

h

C language header file

html htm

HyperText Markup Language file

o

Object ...

Get Classic Shell Scripting now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.