Red Hat Linux 7.2: The Official Red Hat Linux Getting Started Guide | ||
---|---|---|
Prev | Chapter 11. Managing Files and Directories | Next |
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).
Here is a brief listing of extensions and their meanings:
.Z — a compressed file
.tar — an archive file (short for tape archive)
.gz — a compressed file (gzipped)
.tgz — a tarred and gzipped file
For information on creating zip and tar files, see the section called File Compression and Archiving with Gzip, Zip, and Tar
.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 does not have an extension, or the file does not seem to be what the extension says it is 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:
file saturday |
and you will see ASCII text, or something similar, telling you it is a text file. Any file that is 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.