[Previous] [Contents] [Next]

freeze

Compress and uncompress files (UNIX)

Syntax:

freeze [-cdfvV] [[+n1,n2,...,n8] [filename]]...

Options:

-c
Write the results of the freeze/melt operation to standard output. No files are changed.
-d
Uncompress the files from the archive (melt).
-f
Force creation of the .F file. This option creates the .F file, even if one already existed, without prompting you for confirmation. The .F file will be created even if the compressed file is larger than the original.
-v
Display a counter. For each file being frozen, display a kilobytes counter, and, after the file is frozen, print a message giving the percentage of the input file's size that has been saved by compression.
-V
Display the program's version number and compilation options.
-z
If the output of a melt (option -d) is to a tty, allocate a larger output buffer so screen output is in fullscreen chunks.
+n1,n2,...,n8
A list of 8 numbers separated by commas, specifying the values for the static Huffman table.

Description:


Note:

The freeze/melt/fcat compression utilities will eventually become deprecated in favor of the GNU zip suite, gzip/gunzip/zcat. The freeze suite of utilities will continue to be provided for quite some time before being eliminated completely.


The freeze utility compresses the specified files or the standard input. If a file becomes smaller, it's replaced by a file with the extension .F (you can use the -f option to force the creation of the .F file, even if the compressed file is larger). If no files are specified, the compression is applied to the standard input and is written to the standard output.

If you don't specify the -f option, and you run freeze in the foreground, you're prompted as to whether the file should be overwritten.


Caution:

When a .F file is created, the original file is removed.


Normally there will be several links set up to the freeze utility which behave differently when invoked under the following command names:

This link: is equivalent to:
melt freeze -d
fcat freeze -cd

You can restore compressed files to their original form through either of two ways:

When you specify filenames, freeze maintains the ownership, modes, access times, and modification times between the file and its .F version. As a result, freeze can be used for archival purposes, yet can still be used with make after melting.

The freeze utility uses the Lempel-Ziv algorithm on the first pass and the dynamic Huffman algorithm on the second pass. The size of the "sliding window" is 8K and the maximum length of "matched string" is 256. The positions on the window are coded using a static Huffman table.

A two-byte magic number is prepended to the file to ensure that neither melting of random text nor refreezing of already frozen text is attempted. In addition, the characteristics of the static Huffman table being used during the compression are written to the file so that these characteristics may be reused for other files via the "+n1,n2,...,n8" command line argument.

The amount of compression you obtain depends on the size of the input file and the distribution of character substrings and their probabilities. Typically, text files (e.g. C programs) are reduced by 60% to 75%, while executable files are reduced by 50%. Compression is generally much better than that achieved by LZW coding or by Huffman coding, although it takes more time to compute.

An argument preceded by a + defines the values to use for the Huffman table. You may want to explicitly state these values in order to modify the compression algorithm.

Examples:

Freeze all files in the current directory:

    freeze *

Expand files from a compressed pax archive on floppy:

    vol -r /dev/fd0 | melt | pax -r

View the concatenated contents of all compressed files in the current directory:

    fcat *.F | more

Exit status:

0
Normal exit.
1
An error occurred.
2
The last file's compressed size was greater than its original uncompressed size.

Contributing author:

Leonid A. Broukhis

See also:

cpio, fcat, gunzip, gzip, melt, pax, tar, zcat


[Previous] [Contents] [Next]