1 PACK(1)                          User Commands                         PACK(1)
   2 
   3 
   4 
   5 NAME
   6        pack, pcat, unpack - compress and expand files
   7 
   8 SYNOPSIS
   9        pack [-f/] [-] file...
  10 
  11 
  12        pcat file...
  13 
  14 
  15        unpack [-/] file...
  16 
  17 
  18 DESCRIPTION
  19    pack
  20        The pack command attempts to store the specified files in a compressed
  21        form. Wherever possible (and useful), each input file file is replaced
  22        by a packed file file.z with the same access modes, access and modified
  23        dates, and owner as those of file. If pack is successful, file is
  24        removed.
  25 
  26 
  27        The amount of compression obtained depends on the size of the input
  28        file and the character frequency distribution. Because a decoding tree
  29        forms the first part of each .z file, it is usually not worthwhile to
  30        pack files smaller than three blocks, unless the character frequency
  31        distribution is very skewed, which can occur with printer plots or
  32        pictures.
  33 
  34 
  35        Typically, text files are reduced to 60-75% of their original size.
  36        Load modules, which use a larger character set and have a more uniform
  37        distribution of characters, show little compression, the packed
  38        versions being about 90% of the original size.
  39 
  40 
  41        The pack utility returns a value that is the number of files that it
  42        failed to compress. If that number exceeds 255, 255 is returned.
  43 
  44 
  45        No packing occurs if:
  46 
  47            o      the file appears to be already packed
  48 
  49            o      the file name is too long to add the .z suffix
  50 
  51            o      the file has links
  52 
  53            o      the file is a directory
  54 
  55            o      the file cannot be opened
  56 
  57            o      the file is empty
  58 
  59            o      no disk storage blocks are saved by packing
  60 
  61            o      a file called file.z already exists
  62 
  63            o      the .z file cannot be created
  64 
  65            o      an I/O error occurred during processing.
  66 
  67 
  68        The last segment of the file name must be short enough to allow space
  69        for the appended .z extension. Directories cannot be compressed.
  70 
  71    pcat
  72        The pcat command does for packed files what cat(1) does for ordinary
  73        files, except that pcat cannot be used as a filter. The specified files
  74        are unpacked and written to the standard output.
  75 
  76 
  77        pcat returns the number of files it was unable to unpack. Failure can
  78        occur if:
  79 
  80            o      the file cannot be opened;
  81 
  82            o      the file does not appear to be the output of pack.
  83 
  84    unpack
  85        The unpack command expands files created by pack. For each file
  86        specified in the command, a search is made for a file called file.z (or
  87        just file, if file ends in .z). If this file appears to be a packed
  88        file, it is replaced by its expanded version.  The new file has the .z
  89        suffix stripped from its name, and has the same access modes, access
  90        and modification dates, and owner as those of the packed file.
  91 
  92 
  93        unpack returns a value that is the number of files it was unable to
  94        unpack. Failure can occur for the same reasons that it can in pcat, as
  95        well as for the following:
  96 
  97            o      a file with the unpacked name already exists;
  98 
  99            o      the unpacked file cannot be created.
 100 
 101 OPTIONS
 102        The following options are supported by pack:
 103 
 104        -f
 105              Forces packing of file. This is useful for causing an entire
 106              directory to be packed even if some of the files do not benefit.
 107              Packed files can be restored to their original form using unpack
 108              or pcat.
 109 
 110 
 111 
 112        The following options are supported by pack and unpack:
 113 
 114        -/
 115              When packing or unpacking, copies any ACL and extended system
 116              attributes associated with the source file to the target file. If
 117              an ACL or extended system attributes cannot be copied, the
 118              original file is retained, a diagnostic message is written to
 119              stderr, and the final exit status is non-zero.
 120 
 121 
 122 OPERANDS
 123        The following operands are supported:
 124 
 125        file
 126                A path name of a file to be packed, unpacked, or pcated; file
 127                can include or omit the .z suffix.
 128 
 129 
 130        -
 131                pack uses Huffman (minimum redundancy) codes on a byte-by-byte
 132                basis. If the - argument is used, an internal flag is set that
 133                causes the number of times each byte is used, its relative
 134                frequency, and the code for the byte to be printed on the
 135                standard output. Additional occurrences of - in place of file
 136                causes the internal flag to be set and reset.
 137 
 138 
 139 USAGE
 140        See largefile(5) for the description of the behavior of pack, pcat, and
 141        unpack when encountering files greater than or equal to 2 Gbyte (2^31
 142        bytes).
 143 
 144 EXAMPLES
 145        Example 1 Viewing a Packed File
 146 
 147 
 148        To view a packed file named file.z use:
 149 
 150 
 151 
 152        example% pcat file.z
 153 
 154 
 155 
 156        or just:
 157 
 158 
 159 
 160        example% pcat file
 161 
 162 
 163        Example 2 Making an Unpacked Copy:
 164 
 165 
 166        To make an unpacked copy, say nnn, of a packed file named file.z
 167        (without destroying file.z) use the command:
 168 
 169 
 170 
 171        example% pcat file >nnn
 172 
 173 
 174 ENVIRONMENT VARIABLES
 175        See environ(5) for descriptions of the following environment variables
 176        that affect the execution of pack, pcat, and unpack: LC_CTYPE,
 177        LC_MESSAGES, and NLSPATH.
 178 
 179 EXIT STATUS
 180        The following exit values are returned:
 181 
 182        0
 183              Successful completion.
 184 
 185 
 186        >0
 187              An error occurred. The number of files the command failed to
 188              pack/unpack is returned. If the number of failures exceeds 255,
 189              then 255 is returned.
 190 
 191 
 192 ATTRIBUTES
 193        See attributes(5) for descriptions of the following attributes:
 194 
 195 
 196 
 197 
 198        +---------------+-----------------+
 199        |ATTRIBUTE TYPE | ATTRIBUTE VALUE |
 200        +---------------+-----------------+
 201        |CSI            | Enabled         |
 202        +---------------+-----------------+
 203 
 204 SEE ALSO
 205        cat(1), compress(1), zcat(1), fgetattr(3C), fsetattr(3C),
 206        attributes(5), environ(5), largefile(5)
 207 
 208 
 209 
 210                                February 5, 2020                        PACK(1)