which tar bunzip2 gunzip |
This should return the path to these programs , probably /usr/bin/tar, etc. (In FreeBSD probably /usr/local/bin/tar). If it finds it, go to step 3. If it doesn't, there is probably something seriously wrong with your installation that is beyond the scope of this guide. However, you can go to step 2 and see if the instructions there help. (Some distributions, such as Debian, don't install all of these by default, so the instructions in step 2 can quite possibly help).
tar -ztf /tmp/downloads/fetchmail-5.9.tar.gz |
That will tell us the contents of the tarball. Now, we decompress and untar it.
mkdir /usr/local/src/fetchmail tar -zxvf /tmp/downloads/fetchmail-5.9.tar.gz |
At this point, you will see the tarball being decompressed and extracted. Various things will flash across your screen. Assuming it completes with no errors, you will now see that you have a directory inside your /usr/local/src/fetchmail directory called fetchmail-5.9
cd fetchmail-5.9 ls |
You should see a file in there called README. Read it.
less README |
Depending upon the program, it may have installation instructions or may tell you to read another file called INSTALL for directions on installation. If so, then read that one.
less INSTALL |
In most cases, the instructions will give the following sequence. (NOTE: Notice that I said MOST--not ALL. Skipping the above steps of reading the README and INSTALL can sometimes result in needless difficulty)
./configure make make install |
The instructions for installing a tar.bz2 file are almost identical. The difference is in the options passed to the tar command--for a gunzip it was tar -zxvf. For a bz2 it's usually
tar -jxvf fetchmail-5.9.tar.bz2 |
On rare occasions, you'll receive the error message that j is an unknown option. If you get such a message than try
tar -yxvf fetchmail-5.9.tar.bz2 |
If neither works, then you can always try
bunzip2 fetchmail-5.9.tar.bz2 && tar -xvf fetchmail.tar |
bunzip2 file.bz2 |
(If it's a file called file.gz substitute gunzip for bunzip2.)
There is also a compressing format that just has a .Z extension. If you run into it, use the uncompress command. For example, if your file was called file.Z
uncompress file.Z |
If you run across a tarball with it then just do
ucompress file.tar.Z && tar -xvf file.tar |
You may come across files with .tgz and .tbz extensions, for example, FreeBSD distfiles. These are simply abbreviations for tar.gz and tar.bz2, so you can treat a .tgz file as if were called .tar.gz and .tbz files as if they were .tar.bz2 files.
From time to time, you might come across a file with a .zip extension, compressed with the Microsoft format. Most Linux distributions have a zip and unzip command, or have it readily available. In FreeBSD the two are available in /usr/ports/archivers. If you install /usr/ports/archivers/zip I believe it installs unzip as a dependency, but I wouldn't swear to that, nor am I sure if the reverse is true.
If you are using an RPM based distro, and want to install an rpm, the command is (assuming it was fetchmail-5.9.rpm)
rpm -Uvh fetchmail-5.9.rpm |
One may also wish to create their own tarfiles. If you had a directory of good bash scripts called bashscripts and wished to tar and compress them to send to a friend, the command would be (I am using the j option for bz2 format-if you wish gz format substitute z for j)
tar -jcf bashscripts.tar.bz2 bashscripts |
Now that you understand using tarballs, you can go back to the QND guide you were reading, and continue with what is usually step 3.