1pack(1)                          User Commands                         pack(1)
2
3
4

NAME

6       pack, pcat, unpack - compress and expand files
7

SYNOPSIS

9       pack [-f/] [-] file...
10
11
12       pcat file...
13
14
15       unpack [-/] file...
16
17

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 pic‐
32       tures.
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  ver‐
38       sions 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 .zextension. 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  speci‐
86       fied in the command, a search is made for a file called file.z (or just
87       file, if file ends in .z). If this file appears to be a packed file, it
88       is  replaced  by  its  expanded version. The new file has the .z suffix
89       stripped from its name, and has the same access modes, access and modi‐
90       fication 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

OPTIONS

102       The following options are supported by pack:
103
104       -f    Forces  packing  of  file.  This  is useful for causing an entire
105             directory to be packed even if some of the files do not  benefit.
106             Packed  files can be restored to their original form using unpack
107             or pcat.
108
109
110
111       The following options are supported by pack and unpack:
112
113       -/    When packing or unpacking, copies any  ACL  and  extended  system
114             attributes associated with the source file to the target file. If
115             an ACL or extended system attributes cannot be copied, the origi‐
116             nal  file is retained, a diagnostic message is written to stderr,
117             and the final exit status is non-zero.
118
119

OPERANDS

121       The following operands are supported:
122
123       file    A path name of a file to be packed, unpacked, or  pcated;  file
124               can include or omit the .z suffix.
125
126
127       −       pack  uses Huffman (minimum redundancy) codes on a byte-by-byte
128               basis. If the argument is used, an internal flag is set  that
129               causes the number of times each byte is used, its relative fre‐
130               quency, and the code for the byte to be printed on the standard
131               output. Additional occurrences of in place of file causes the
132               internal flag to be set and reset.
133
134

USAGE

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

EXAMPLES

141       Example 1 Viewing a Packed File
142
143
144       To view a packed file named file.z use:
145
146
147
148       example% pcat file.z
149
150
151
152       or just:
153
154
155
156       example% pcat file
157
158
159       Example 2 Making and Unpacked Copy:
160
161
162       To make an unpacked copy, say nnn, of a packed file named file.z (with‐
163       out destroying file.z) use the command:
164
165
166
167       example% pcat file >nnn
168
169

ENVIRONMENT VARIABLES

171       See  environ(5) for descriptions of the following environment variables
172       that affect the execution of pack, pcat, and unpack: LC_CTYPE,  LC_MES‐
173       SAGES, and NLSPATH.
174

EXIT STATUS

176       The following exit values are returned:
177
178       0     Successful completion.
179
180
181       >0    An  error  occurred.  The  number  of files the command failed to
182             pack/unpack is returned. If the number of failures  exceeds  255,
183             then 255 is returned.
184
185

ATTRIBUTES

187       See attributes(5) for descriptions of the following attributes:
188
189
190
191
192       ┌─────────────────────────────┬─────────────────────────────┐
193ATTRIBUTE TYPE               ATTRIBUTE VALUE              
194       ├─────────────────────────────┼─────────────────────────────┤
195       │Availability                 │SUNWesu                      │
196       ├─────────────────────────────┼─────────────────────────────┤
197       │CSI                          │Enabled                      │
198       └─────────────────────────────┴─────────────────────────────┘
199

SEE ALSO

201       cat(1),  compress(1), zcat(1), fgetattr(3C), fsetattr(3C)attributes(5),
202       environ(5), largefile(5)
203
204
205
206SunOS 5.11                        13 Mar 2008                          pack(1)
Impressum