Re: Compressing folders/sub-folders with TAR : how to ?

From: Stephane CHAZELAS (this.address_at_is.invalid)
Date: 01/26/05

  • Next message: Ian Stirling: "Re: Compressing folders/sub-folders with TAR : how to ?"
    Date: Wed, 26 Jan 2005 17:47:18 +0000
    
    

    2005-01-26, 06:57(-08), A Web Master:
    > What's the syntax to compress all folders and sub-folders found with TAR ?

    tar is not a compressor, that's an archiver. tar makes an
    archive, it provides with a stream of data containing the
    representation of a directory tree.

    Compression is the job of other tools like gzip or compress or
    bzip2 whose role is to take an arbitrary stream of data as input
    and produce a compressed stream of data as output.

    tar cf - . | gzip > ../file.tar.gz

    creates a compressed archive of the current directory (.) stored
    in the ../file.tar.gz file.

    3 tools were contributing in making that archive:

    1- the shell that created and opened the file for writing and
    launched and connected the two other tools together.

    2- tar that produced the archive stream on its standard output
    (with the -f -, otherwise by default, tar would put that stream
    on a tape as it's a Tape ARchiver).

    3- gzip that read the data from its standard input (that was
    connected to tar's standard output via a pipe created by the
    shell (and managed by the Unix system)) and wrote the compressed
    data on its standard output (that was connected to the file by
    the shell).

    That's a simple example of how you can combine simple tools
    together to have them perform a more complex task.

    -- 
    Stéphane
    

  • Next message: Ian Stirling: "Re: Compressing folders/sub-folders with TAR : how to ?"

    Relevant Pages

    • Re: cp file from tape
      ... > My backup tape has been corrupted. ... I used tar command ... A tarball is a stream of bytes. ... compress its data, compresses individual files and writes those compressed ...
      (Fedora)
    • Re: Binaries deployment is not easy on Linux ?
      ... > Do you think the packaging and deployment of binaries is very easy on linux? ... tar is only a archiver, and in fact was designed to be a Tape ARchiver. ... You can compress any time of file, ...
      (comp.os.linux.setup)
    • Re: FTPing a folder across to remote webspace
      ... > lot of repeated test it will compress a lot. ... > gzip only processes single files, so yes you should tar first. ... > In your message you mentioned databases, but not which sort of database. ... MySQL backup. ...
      (uk.comp.os.linux)
    • Re: Random access to content of archived files without extraction - how? compression scheme? alg
      ... I'll use an archiver that archive and compress in a single pass; ... basically reduced to read a buffer of size, i.e. "s" of data from your ... output with his compressed size (to allow uncompress to work), ...
      (comp.compression)
    • Compression to a fit a space...
      ... get to fit. ... My current implementation simply builds a tar one file at a time, ... However these logs compress quite substantially, ...
      (comp.os.linux.development.apps)