Results 1 to 7 of 7

Thread: Compression Tools

  1. #1
    Moderator
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,760

    Compression Tools

    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!

  2. #2
    Advisor Lovechild's Avatar
    Join Date
    Apr 2005
    Location
    Århus, Denmark
    Posts
    579
    You could add 7zip to the list, many people are converting to it due to it's high compression rate.
    Why are you not using Fedora Core?

    My blog

  3. #3
    Mentor jro's Avatar
    Join Date
    May 2004
    Location
    Pennsylvania, USA
    Posts
    1,206
    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.
    jro - http://jeff.robbins.ws
    Linux counter#:213782
    GnuPG ID: 406238E7

  4. #4
    Associate
    Join Date
    Feb 2006
    Location
    Ohio USA
    Posts
    18
    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.

  5. #5
    Mentor jro's Avatar
    Join Date
    May 2004
    Location
    Pennsylvania, USA
    Posts
    1,206
    Wow, I had forgotten all about compress/uncompress. Do you remember what algorithm they use for compression?
    jro - http://jeff.robbins.ws
    Linux counter#:213782
    GnuPG ID: 406238E7

  6. #6
    Moderator
    Good Guru
    Schotty's Avatar
    Join Date
    Jul 2001
    Location
    Milwaukee, WI
    Posts
    5,760
    Quote Originally Posted by DotHQ
    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.

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

  7. #7
    Moderator
    Kind Mastermind
    stryder144's Avatar
    Join Date
    Aug 2001
    Location
    Denver, CO
    Posts
    2,924
    Quote Originally Posted by Lovechild
    You could add 7zip to the list, many people are converting to it due to it's high compression rate.
    Good call. I use 7zip on my wife's windows computer. Very good tool for the space conscience among us.
    The one serious conviction that a man should have is that nothing is to be taken too seriously.
    Where facts are few, experts are many.

Similar Threads

  1. Useful Tools
    By RickDev in forum Windows - General Topics
    Replies: 1
    Last Post: 07-11-2006, 06:31 PM
  2. Tools, gotta have more tools.
    By Fatal Error in forum General Chat
    Replies: 0
    Last Post: 04-14-2005, 11:10 PM
  3. DVD Compression
    By doria in forum Linux - General Topics
    Replies: 6
    Last Post: 11-28-2004, 05:55 AM
  4. MPEG Compression
    By shebang in forum Linux - Software, Applications & Programming
    Replies: 4
    Last Post: 08-13-2004, 12:37 PM
  5. Filesystem -- Compression Tools (bzip2, tar, gzip)
    By Schotty in forum Linux - General Topics
    Replies: 2
    Last Post: 07-10-2002, 06:52 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •