Unix‎ > ‎Solaris‎ > ‎Solaris man pages‎ > ‎1‎ > ‎


     pack, pcat, unpack - compress and expand files

     pack [-f] [-] file...

     pcat file...

     unpack file...

     The pack command attempts to store the specified files in  a
     compressed  form. Wherever possible (and useful), each input
     file file is replaced by a packed file file.z with the  same
     access  modes, access and modified dates, and owner as those
     of file. If pack is successful, file will be removed.

     The amount of compression obtained depends on  the  size  of
     the  input  file  and  the character frequency distribution.
     Because a decoding tree forms the  first  part  of  each  .z
     file,  it  is  usually  not worthwhile to pack files smaller
     than three blocks, unless the character frequency  distribu-
     tion  is  very skewed, which may occur with printer plots or

     Typically, text files are reduced to 60-75% of their  origi-
     nal size. Load modules, which use a larger character set and
     have a more uniform distribution of characters, show  little
     compression, the packed versions being about 90% of the ori-
     ginal size.

     pack returns a value that is the number  of  files  that  it
     failed to compress.

     No packing will occur if:

       o  the file appears to be already packed

       o  the file name has more than 14 - 2 bytes

       o  the file has links

       o  the file is a directory

       o  the file cannot be opened

       o  the file is empty

       o  no disk storage blocks will be saved by packing

          a file called file.z already exists

       o  the .z file cannot be created

       o  an I/O error occurred during processing.

     The last segment of the file name must contain no more  than
     14  -  2 bytes to allow space for the appended .z extension.
     Directories cannot be compressed.

     The pcat command does for packed files what cat(1) does  for
     ordinary files, except that pcat cannot be used as a filter.
     The specified files are unpacked and written to the standard

     pcat returns the number of files it was  unable  to  unpack.
     Failure may occur if:

       o  the file cannot be opened;

       o  the file does not appear to be the output of pack.

     The unpack command expands files created by pack.  For  each
     file  specified  in the command, a search is made for a file
     called file.z (or just file, if file ends in  .z).  If  this
     file  appears  to  be  a  packed file, it is replaced by its
     expanded version.  The new file has the .z  suffix  stripped
     from  its  name,  and  has the same access modes, access and
     modification dates, and owner as those of the packed file.

     unpack returns a value that is the number of  files  it  was
     unable  to  unpack.  Failure  may occur for the same reasons
     that it may in pcat, as well as for the following:

       o  a file with the ``unpacked'' name already exists;

       o  the unpacked file cannot be created.

       o  the filename (excluding the .z extension) has more than
          14 bytes.

     The following options are supported by pack:

     -f       Forces packing of file. This is useful for  causing
              an  entire  directory  to be packed even if some of
              the files will not benefit.  Packed  files  can  be
              restored  to  their  original  form using unpack or

     The following operands are supported:

     file            A  path  name  of  a  file  to  be   packed,
                     unpacked,  or  pcated;  file  can include or
                     omit the .z suffix.

     -               pack uses Huffman (minimum redundancy) codes
                     on  a  byte-by-byte basis. If the - argument
                     is used, an internal flag is set that causes
                     the  number  of times each byte is used, its
                     relative frequency, and  the  code  for  the
                     byte  to  be printed on the standard output.
                     Additional occurrences of - in place of file
                     will  cause  the internal flag to be set and

     See largefile(5) for the  description  of  the  behavior  of
     pack,  pcat, and unpack when encountering files greater than
     or equal to 2 Gbyte ( 2**31 bytes).

     Example 1: Viewing a Packed File

     To view a packed file named file.z use:

          example% pcat file.z
          or just:
          example% pcat file

     Example 2: Making and Unpacked Copy:

     To make an unpacked copy, say nnn, of a  packed  file  named
     file.z (without destroying file.z) use the command:

          example% pcat file >nnn

     See environ(5) for descriptions of the following environment
     variables  that  affect  the  execution  of  pack, pcat, and
     unpack: LC_CTYPE, LC_MESSAGES, and NLSPATH.

     The following exit values are returned:

     0        Successful completion.

     >0       An error occurred. The number of files the  command
              failed to pack/unpack is returned.

     See attributes(5) for descriptions of the  following  attri-

    |       ATTRIBUTE TYPE        |       ATTRIBUTE VALUE       |
    | Availability                | SUNWesu                     |
    | CSI                         | Enabled                     |

     cat(1),  compress(1),  zcat(1),  attributes(5),  environ(5),
     largefile( 5)

Man pages from Solaris 10 Update 8. See docs.sun.com and www.oracle.com for further documentation and Solaris information.