ibm-information-center/dist/eclipse/plugins/i5OS.ic.rzahz_5.4.0.1/compress.htm

117 lines
3.7 KiB
HTML
Raw Normal View History

2024-04-02 14:02:31 +00:00
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org">
<meta http-equiv="Content-Type" content=
"text/html; charset=utf-8">
<title>compress - Compress data</title>
<LINK rel="stylesheet" type="text/css" href="../rzahg/ic.css">
</HEAD>
<body bgcolor="#FFFFFF">
<!-- Java sync-link -->
<SCRIPT LANGUAGE="Javascript" SRC="../rzahg/synch.js" TYPE="text/javascript"></SCRIPT>
<h2>compress - Compress
data</h2>
<strong>Synopsis</strong>
<p><strong>compress [-cfv] [-b</strong> <em>
bits</em><strong>]</strong> [<em>file ...</em>]</p>
<p><strong>Description</strong></p>
<p>The <strong>compress</strong> utility reduces the size of the
<em>files</em> using adaptive Lempel-Ziv coding. Each <em>file</em>
is renamed to the same name plus the extension ".Z". As many of the
modification time, access time, file flags, file mode, user ID, and
group ID as allowed by permissions are retained in the new file. If
compression would not reduce the size of a file, the <em>file</em>
is ignored.</p>
<p>If renaming <em>file</em> would cause files to be overwritten
and the standard input device is a terminal, the user is prompted
(on standard error) for confirmation. If prompting is not possible
or confirmation is not received, the files are not overwritten.</p>
<p><strong>Options</strong></p>
<dl>
<dt><strong>-b</strong> <em>bits</em></dt>
<dd>Specify the bits code limit (see below for details).</dd>
<dt><strong>-c</strong></dt>
<dd>Compressed output is written to the standard output. No files
are modified.</dd>
<dt><strong>-f</strong></dt>
<dd>Force compression of <em>file</em>, even if it is not actually
reduced in size. Additionally, files are overwritten without
prompting for confirmation.</dd>
<dt><strong>-v</strong></dt>
<dd>Print the percentage of reduction for each <em>file</em>.</dd>
</dl>
<p><strong>Operands</strong></p>
<p>Each <em>file</em> is a pathname of a file to compress. If no
<em>files</em> are specified, the standard input is compressed to
the standard output. If either the input or output files are not
regular files, the checks for reduction in size and file
overwriting are not performed, the input file is not removed, and
the attributes of the input file are not retained.</p>
<p><strong>Extended Description</strong></p>
<p>The <strong>compress</strong> utility uses a modified Lempel-Ziv
algorithm. Common substrings in the file are first replaced by
9-bit codes 257 and up. When code 512 is reached, the algorithm
switches to 10-bit codes and continues to use more bits until the
limit specified by the <strong>-b</strong> flag is reached (the
default is 16). Bits must be between 9 and 16.</p>
<p>After the bits limit is reached, <strong>compress</strong>
periodically checks the compression ratio. If it is increasing,
<strong>compress</strong> continues to use the existing code
dictionary. However, if the compression ratio decreases, <strong>
compress</strong> discards the table of substrings and rebuilds it
from scratch. This allows the algorithm to adapt to the next
"block" of the file.</p>
<p>The amount of compression obtained depends on the size of the
input, the number of bits per code, and the distribution of common
substrings. Typically, text such as source code or English is
reduced by 50-60%.</p>
<p><strong>Exit Status</strong></p>
<ul>
<li>0 on success</li>
<li>&gt;0 if an error occurs.</li>
</ul>
<p><strong>Related information</strong></p>
<ul>
<li><a href="pax.htm">pax - Portable archive interchange</a></li>
<li><a href="uncompress.htm">uncompress - Expand compressed
data</a></li>
<li><a href="zcat.htm">zcat - Expand and concatenate data</a></li>
</ul>
<!-- end ibmbody========================================================= -->
</body>
</html>