Filename Extension Definition

A filename extension, also commonly referred to as just an extension, is usually defined as a short string (i.e., sequence of characters) that is added to the end of the base name (i.e., the main part of the name) of a file after a period (i.e., a dot) in order to indicate the type of file.

Some operating systems, such as MS-DOS and the Microsoft Windows systems, require the use of extensions in order for the system to function, and almost every file has an extension. However, this might not always be obvious because the system can be configured so that the extensions are hidden from view.

Linux and other Unix-like operating systems themselves generally do not require the use of extensions, although some application programs that run on them do. However, even when extensions are not actually needed, they are frequently used because they can make it easier for users to tell the type of file at a glance.

Some common extensions used on Unix-like operating systems are:

    .bz2 - compressed with the bzip2 compression utility
    .c - C language source code
    .conf and cfg - configuration file
    .d - directory containing scripts or configuration files
    .deb - Debian software package
    .gif - GIF (Graphic Interchange Format) image
    .gz - compressed using the gzip utility
    .h - C language header file
    .html - HTML (Hypertext Markup Language) format
    .img - image, i.e., exact copy of a file
    .java - Java source code
    .jpg or .jpeg - JPEG (Joint Photographic Experts Group) image
    .mpg or .mpeg - MPEG (Motion Picture Experts Group) movie
    .php - PHP language program
    .png - PNG (Portable Network Graphics) image
    .sgml - SGML (Standardized General Markup Language) format
    .rc - run command configuration data
    .rpm - Red Hat Package Manager software package
    .so - shared object in a dynamic library
    .tar - archive created with the tar utility
    .txt or .text - plain text
    .tex - text formatted in the TeX or LaTeX formatting language
    .xml - XML (Extended Markup Language) format

File names can have multiple extensions. Among the most common are .tar.bz2 and .tar.gz, both of which are widely used for the distribution of compressed programs for Unix-like operating systems.

Along with the operating system itself, many application programs on Unix-like operating systems likewise do not require filename extensions. For example, a JPEG image file does not require a .jpg or .jpeg extension in order for it to function properly. However, some programs do require extensions in order to recognize some types of files. For example, which compiling a program written in the C programming language, the compiler requires that the source code have a .c extension and that header files have a .h extension.

Although filename extensions are usually thought of as being one or more letters following a period that are added to the end of the name of a file, they can be regarded more broadly as any characters that are added to the names of filesystem objects (i.e., files, directories and links) to indicate the type of object. An example is the tilde (the short, curvy horizontal line that is located on the upper left of most keyboards) at the end of the name of automatically generated backup copies of files produced by the gedit text editor.

Likewise, a dot added to the beginning of the name of a file (or other filesystem object) to make it a hidden file (i.e., an object that is normally not visible to users) could also be regarded as an extension. As is the case with conventional filename extensions in Unix-like operating systems, the dot has no effect on the system or its relationship with the object.

Created June 27, 2005. Updated July 25, 2006.
Copyright © 2005 - 2006 The Linux Information Project. All Rights Reserved.