


COMPRESS(1)					   COMPRESS(1)


NNAAMMEE
       compress,  uncompress,  zcat   -	compress and uncompress
       files

SSYYNNOOPPSSIISS
       ccoommpprreessss [ --cc ] [ --CC ] [ --dd ] [ --ff ] [ --vv ] [ --bb _b_i_t_s ] [ _f_i_l_e_n_a_m_e
       _._._.  ]
       uunnccoommpprreessss [ --cc ] [ --ff ] [ --vv ] [ --VV ] [ _f_i_l_e_n_a_m_e _._._.  ]
       zzccaatt [ _f_i_l_e_n_a_m_e _._._.  ]

DDEESSCCRRIIPPTTIIOONN
       Compresses  the	specified  files or standard input.  Each
       file is replaced by a file with the extension ..ZZ,, but only
       if  the	file got smaller.  If no files are specified, the
       compression is applied to the standard input and is  writ-
       ten  to	standard  output regardless of the results.  Com-
       pressed files can be restored to their  original	form  by
       specifying the --dd option, or by running _u_n_c_o_m_p_r_e_s_s (linked
       to _c_o_m_p_r_e_s_s), on the ..ZZ files or the standard input.

       If the output file exists,  it  will  not  be  overwritten
       unless  the  --ff flag is given.  If --ff is not specified and
       _c_o_m_p_r_e_s_s is run in the foreground, the user is prompted as
       to whether the file should be overwritten.

       If  the --ff flag is given, all files specified are replaced
       with ..ZZ files - even if the file didn't get smaller.

       When file names are given, the ownership (if run by root),
       modes,  accessed and modified times are maintained between
       the file and its ..ZZ version.  In	this  respect,	_c_o_m_p_r_e_s_s
       can  be	used for archival purposes, yet can still be used
       with _m_a_k_e(1) after uncompression.

       The  --cc	option	causes	the	results	of   the   com-
       press/uncompress	operation  to	be  written to stdout; no
       files are changed.  The _z_c_a_t program is the same as speci-
       fying --cc to _u_n_c_o_m_p_r_e_s_s (all files are unpacked and written
       to stdout).

       _C_o_m_p_r_e_s_s uses the modified Lempel-Ziv algorithm	described
       in  "A  Technique  for High Performance Data Compression",
       Terry A. Welch, _I_E_E_E _C_o_m_p_u_t_e_r Vol 17, No 6 (June 1984), pp
       8-19.  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 _b_i_t_s limit as specified by the --bb flag
       is  reached  (default 16).  _B_i_t_s must be between 9 and 16.
       The default can be changed in the source to allow _c_o_m_p_r_e_s_s
       to be run on a smaller machine.

       After  the  _b_i_t_s	limit	is reached, _c_o_m_p_r_e_s_s periodically
       checks the compression ratio.  If it is	increasing,  _c_o_m_-
       _p_r_e_s_s  continues	to  use  the  codes that were previously



			      local				1





COMPRESS(1)					   COMPRESS(1)


       found in the file.   However,  if  the  compression  ratio
       decreases,  _c_o_m_p_r_e_s_s  discards the table of substrings and
       rebuilds it from scratch.  This allows  the  algorithm  to
       adapt  to  the next "block" of the file.	The --CC (compati-
       bility) flag prevents subdivision of the file into blocks;
       this produces an output file that old versions of _c_o_m_p_r_e_s_s
       can read.

       A two byte magic number is prepended to the file to ensure
       that  neither  uncompression of random text nor recompres-
       sion of compressed text are attempted.  In  addition,  the
       _b_i_t_s  specified	during _c_o_m_p_r_e_s_s is written to the file so
       that the --bb flag can be omitted for _u_n_c_o_m_p_r_e_s_s.

       The amount of compression obtained depends on the size  of
       the  input file, the amount of _b_i_t_s per code, and the dis-
       tribution of character substrings.  Typically, text files,
       such as C programs, are reduced by 50-60%.  Compression is
       generally much better than that achieved by Huffman coding
       (as  used  in _p_a_c_k), or adaptive Huffman coding (_c_o_m_p_a_c_t),
       and takes less time to compute.


       If the --vv (verbose) flag is given, then after each file is
       compressed,  a message is printed giving the percentage of
       the input file that has been saved by compression.

       If the --VV (version) flag is given, the  program's  version
       number is printed.

       The  exit status is normally 0; if the last file gets big-
       ger after compression, the exit status is 2; if	an  error
       occurs, the exit status is 1.

SSEEEE AALLSSOO
       compact(1), pack(1)

DDIIAAGGNNOOSSTTIICCSS
       Usage: compress [-cCdfvV] [-b maxbits] [file ...]
	       Invalid	options	were  specified  on  the command
	       line.
       Missing maxbits
	       Maxbits must follow --bb.
       Unknown flag: _'_x_'_;
	       Invalid flags were specified on the command  line.
       _f_i_l_e: not in compressed format
	       The specified file has not been compressed.
       _f_i_l_e: compressed with _x_x bits, can only handle _y_y bits
	       The  specified  file  was compressed by a compress
	       program that could handle more _b_i_t_s than the  cur-
	       rent compress program.  Recompress the file with a
	       smaller _b_i_t_s.
       _f_i_l_e: already has .Z suffix -- no change
	       Cannot compress a file that  has	a  ".Z"  suffix.



			      local				2





COMPRESS(1)					   COMPRESS(1)


	       _m_v(1)  the file to a different name and try again.
       _f_i_l_e: filename too long to tack on .Z
	       The specified file cannot  be  compressed  because
	       its  filename is longer than 12 characters.  _m_v(1)
	       the file to a different name and try again.   This
	       message does not occur on 4.2BSD systems.
       _f_i_l_e already exists; do you wish to overwrite (y or n)?
	       Respond	"y"  if	you  want  the output file to be
	       replaced; "n" if you want it to be left alone.
       _f_i_l_e:
	       This message fragment is written during	the  pro-
	       cessing of a file.
       Compression: _x_x_._x_x_%
	       This  message fragment gives the percentage of the
	       input file that has been saved by compression.
       -- not a regular file: unchanged
	       This message fragment is written	when  the  input
	       file  is	not  a	regular file.	The input file is
	       left unchanged.
       -- has _x_x other links: unchanged
	       This message fragment is written	when  the  input
	       file has links.	The input file is left unchanged.
	       See _l_n(1) for more information.
       -- file unchanged
	       This message fragment is written when  no  savings
	       are  achieved  by  compression.	The input file is
	       left unchanged.
       -- replaced with _f_i_l_e
	       This message fragment is written when a	file  has
	       been sucessfully compressed/uncompressed.



























			      local				3


