Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions

  




 

 

14.2. Identifying and Working with File Types

If you are new to Linux, you may see certain file types that you do not recognize because of their unfamiliar extension. 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 file extensions and their meanings:

14.2.1. Compressed and Archived Files

  • .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.

  • .zip — a file compressed with ZIP compression, commonly found in MS-DOS applications. Most compressed files for Linux use the gzip compression, so finding a .zip archive for Linux files is rare.

For information on working with bzip2, gzip, and tar files, refer to Section 14.3 File Compression and Archiving.

14.2.2. File Formats

  • .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 (short 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

14.2.3. System Files

  • .conf — a configuration file. Configuration files sometimes use the .cfg extension, as well.

  • .lock — a lock file; determines whether a program or device is in use

  • .rpm — a Red Hat Package Manager file used to install software

14.2.4. Programming and Scripting Files

  • .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

  • .py — a Python script

  • .so — a library file

  • .sh — a shell script

  • .tcl — a TCL script

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 example, 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 file saturday will display ASCII text, telling you it is a text file. Any file that is designated as a text file should be readable by using the cat, more, or less commands, or by using a text editor such as gedit or vi.

TipTip
 

To learn more about file, read the man page by typing man file.

For more information on helpful commands for reading files, see Chapter 13 Shell Prompt Basics.

 
 
  Published under the terms of the GNU General Public License Design by Interspire