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*

Extension

File Type

.bz2

A file compressed with bzip2

.gz

A file compressed with gzip

.tar

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

.tbz

A tarred and bzipped file

.tgz

A tarred and gzipped file

File Formats

Extension

File Type

.au

An audio file

.gif

A GIF image file

.html/.htm

An HTML file

.jpg

A JPEG image file

.pdf

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

.png

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

.ps

A PostScript file; formatted for printing

.txt

A plain ASCII text file

.wav

An audio file

.xpm

An image file

System Files

Extension

File Type

.conf

A configuration file

.lock

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

.rpm

A Red Hat Package Manager file used to install software

Programming and Scripting Files

Extension

File Type

.c

A C program language source code file

.cpp

A C++ program language source code file

.h

A C or C++ program language header file

.o

A program object file

.pl

A Perl script

.so

A library file

.tcl

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.

Tip

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
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 223

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net