You could add 7zip to the list, many people are converting to it due to it's high compression rate.
Due to the sometimes confusing nature of the command line interface (CLI), I have been asked
to do this small PET on how to use file compression tools.
INTO THE WORLD OF COMPRESSION
-----------------------------
First off, I would hope that most people know what a .ZIP file is from the days of dark --
Windows. UNIX has the same thing. Except there are two flavors - GnuZip and BZip.
Although many tend to only consider gzip, bzip is quite common as well. Tar is Tape
ARchive. And is there for making it easier for dropping just one file on a backup media. A
'tarball' is a tar.gz file. The easiest way to uncompress the files are as below. I added
a few nifty parameters, but for a full list a man {bzip2,tar,gzip} will greatly aid you in
finding the answer to the question at hand.
------
-GZIP-
------
SAMPLE OPTIONS
--------------
gzip -options filename
-d decompress
-l list data
-N save filename and original timestamps
-r recursive
-v verbose output
-# replace # with a 1 - 9 (fastest to best compression)
EXAMPLE
gzip -dv beer.gz
gzip decompresses beer.gz and displays the files as they are decompressed. Beer.gz is
removed as whatever file inside is placed on the hard disk.
gzip -v beer
creates an archive of beer, called beer.gz
-----
-TAR-
-----
SAMPLE OPTIONS
--------------
tar -options filename files
-c create
-j bzip2
-r append
-t list
-u update
-x extract
-v verbose
-f specifies file
-z use gzip
EXAMPLE
-------
tar -xvf beer.tar
extracts content of beer.tar to the local directory. If there are directories specified, it
will create a subdirectory there.
tar -cvf beer.tar beer*
creates a tar called beer.tar of all files beginning with 'beer'.
tar -zxvf beer.tar.gz
extracts all files in beer.tar.gz and places them in your working directory.
tar -czvf beer.tar.gz beer*
compresses and tars the result, of all the files beginning with 'beer' in you working
directory
tar -jvfx beer.tar.bz2
extracts all files from archive and places them in the current working directory
-------
-BZIP2-
-------
SAMPLE OPTIONS
--------------
[Edit -- I am not god with bzip2, so email me with any additions. Thanks]
bzip2 -OPTIONS filename
-d decompress
-v verbose
EXAMPLES
--------
bzip -v beer
bzips the file beer into the file beer.bz
bzip -df beer.bz
uncompresses content of beer.bz into current working directory
Thats it guys! Lemme know what you need correcting/updated/added.
May the beer flow freely!
You could add 7zip to the list, many people are converting to it due to it's high compression rate.
You might add -P to the useful tar options. I have used this on _MANY_ occasions. Tar pukes when it encounters file names that have '..' in them. This is common for people like me that happen to reference files relatively rather than absolutely (yes, yes, absolute is better, but I forget sometimes)
So if you create an archive that you first have to back out of (eg tar -cvf myTar.tar ../../another/dir) its going to save the file names with the '../../', which tar really doesn't like. Tar will complain if you try 'tar -xvf myTar.tar', you have to use tar -xvPf myTar.tar, which will extract it. But REMEMBER!, this will extract the contents of the tar to '../../another/dir' so be aware of where you are extracting it!! Or better yet, just don't include the '..' in you archives.
What's wrong with compress and uncompress? They've been around forever, and still work.
Simple to use:
compress filename
uncompress filename
Compress will put a uppercase Z at the end of a compressed file. Makes them easy to spot.
Wow, I had forgotten all about compress/uncompress. Do you remember what algorithm they use for compression?
Originally Posted by DotHQ
From what I gather the compression algorithm stinks. I guess the better is bzip, followed by gzip.
On a similar note, I have decided to add 7zip and some basic instructions on how to add it to fedora and linspire (since those are the only distros I care to use).
Bookmarks