Identifying and Working with File Types

If you are new to Linux, you may see files with extensions you do not recognize. A file's extension is the last part of a file's name after the final dot (in the file sneakers.txt, "txt" is that file's extension).

Table 9-1 shows the major file extensions and their meanings.

Table 9-1: File Types and Extensions

Compressed and Archived Files*


File Type


A file compressed with bzip2


A file compressed with gzip


A file archived with tar (short for tape archive), also known as a tar file


A tarred and bzipped file


A tarred and gzipped file

File Formats


File Type


An audio file


A GIF image file


An HTML file


A JPEG image file


An electronic image of a document (PDF stands for Portable Document Format)


A PNG image file (PNG stands for Portable Network Graphic)


A PostScript file; formatted for printing


A plain ASCII text file


An audio file


An image file

System Files


File Type


A configuration file


A lock file; determines whether a program or device is in use


A Red Hat Package Manager file used to install software

Programming and Scripting Files


File Type


A C program language source code file


A C++ program language source code file


A C or C++ program language header file


A program object file


A Perl script


A library file


A TCL script

* For information on working with bzip2, gzip, and tar files, refer to the “Compressing Files from the Shell Prompt” section later in this chapter.

But file extensions are not always used, or used consistently. So what happens when a file does not have an extension, or the file does not seem to be what the extension says it is supposed to be?

That is when the file command can be helpful.

For instance, you find a file called saturday without an extension. Using the file command, you can tell what type of file it is by typing

file saturday

In the example, the command output display tells you the file is an ASCII text file.

Any file that is designated as a text file should be readable using the cat, more, or less commands, or using a text editor.


To learn more about file, read the man page by typing man file. For more information on helpful commands for reading files, see Chapter 8.

The Red Hat Documentation Team - Official Red Hat Linux User's Guide
The Red Hat Documentation Team - Official Red Hat Linux User's Guide
Year: 2002
Pages: 223 © 2008-2017.
If you may any questions please contact us: