Dont confuse urself. I will do it in short and simple words.
1. RPM
RedHat Package Manager files are readily compiled binaries. U can just install it by initiating:
# rpm -ivh my-application.rpm
2. src.rpm
Source RPM. This is the package contains only the source code for the an application.
When u install this binary, all the source code will be extracted to ur linux system. No binaries/executable files for u to run an application.
To run an installation on src.rpm files:
# rpm -ivh my-application.src.rpm
3. tar.gz
The content in this package can be either a binary/a source code okay. Dont' relate it with RPM. U will only get confused.
IMPORTANT: .tar.gz is a way used to compress files/directories into one small file.
Let's say i have a "Directory" call "MyDirectory" and it it contains all my files and programs. If i wan to compress it into one file i do this:
# tar czvf MyDirectory.tar.gz MyDirectory
To extract files:
# tar xzvf MyDirectory.tar.gz
4. tar.bz2
Same explaination as in [3], the difference is that, when u see tar.gz (it's using gzip compression to compress files).
Let's say i have a "Directory" call "MyDirectory" and it it contains all my files and programs. If i wan to compress it into one file i do this:
# tar cjvf MyDirectory.tar.bz2 MyDirectory
To extract files:
# tar xjvf MyDirectory.tar.bz2
And when u see tar.bz2, (it's using bzip2 compression to compress files)
5. tgz
This is very confusing indeed. I divide this into 2 category:
========
Category #1
========
Slackware use tarballs, with .tgz extension for their compiled binaries that is readily to be installed.
For example:
# installpkg my-slackware-tarball.tgz
Don't worry bout this, if they tell u it's a Slackware tarball. Then it is.
========
Category #2
========
Sometimes developers for some applications use .tgz file extension to represent .tar.gz extensions.
Just remember:
If websites that gives u a tgz file and never mention it's a Slackware tarball/package.
IT IS A NORMAL TARRED GZIPPED ARCHIVE
tgz = tar.gz
6. .Z
Some ppl call it a Liempel Z... i don remember the compression name used. But this is another type of archive:
To compress using this Liempel algorithm:
# compress myfile
(And u will get a file called myfile.Z)
To uncompress using this Liempel algorithm:
# uncompress myfile.Z