If you're new to Linux, you may see files with extensions you don't
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).
Here's a brief listing of extensions and their meanings:
.txt — a plain ASCII text file
.html/.htm — an HTML file
.ps — a PostScript file; formatted for
printing
.au — an audio file
.wav — an audio file
.xpm — an image file
.jpg — a graphical or image file, such
as a photo or artwork
.gif — a graphical or image file
.png — a graphical or image file
.pdf — an electronic image of a
document
For information on viewing and creating PDF files, see the section called Viewing PDFs
.rpm — a Red Hat Package Manager file
.conf — a configuration file
.a — an archive file
.lock — a "lock" file; determines
whether a program is in use
.h — a C or C++ program language
header file
.c — a C program language source code
file
.cpp — a C++ program language source
code file
.o — a program object file
.pl — a Perl script
.tcl — a TCL script
.so — a library file
But file extensions are not always used, or used consistently. So what
happens when a file doesn't have an extension, or the file doesn't
seem to be what the extension says it's supposed to be?
That's when the file command can be helpful.
In the section called Using Redirection in Chapter 10, you created a file
called saturday, without an extension. Using the
file command, you can tell what the file is by
typing:
and you'll see ASCII text, or something
similar, telling you it's a text file. Any file that's designated a
text file should be readable using cat,
more, or less.
 | Read the Man Page |
|---|
| | To learn more about file, read the
man page by typing man file.
|
For more information on helpful commands for reading files, see Chapter 10.