The Single UNIX ® Specification, Version 2
Copyright © 1997 The Open Group

 NAME

pack - compress files (LEGACY)

 SYNOPSIS



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

 DESCRIPTION

The pack utility attempts to store the specified files in a compressed form. Each input file is replaced by a packed file file.z. If the invoking process has appropriate privileges, the ownership, modes, access time, and modification time of the original file are preserved. If pack is successful, file will be removed. Packed files can be restored to their original form using unpack or pcat.

No packing will occur if:

The last segment of the filename must contain no more than {NAME_MAX}-2 bytes to allow space for the appended .z extension.

 OPTIONS

The pack utility supports the XBD specification, Utility Syntax Guidelines  . The following option is supported:

-f
Force packing of files. This is useful for causing an entire directory to be packed even if some of the files will not benefit.

 OPERANDS

The following operands are supported:
-
Sets an internal flag that causes the number of times each byte is used, its relative frequency and the code for the byte to be written to standard output. Additional occurrences of - in place of file will cause the internal flag to be set and reset.
file
A pathname of a file to be packed; file can include or omit the .z suffix.

 STDIN

Not used.

 INPUT FILES

The input files are regular files.

 ENVIRONMENT VARIABLES

The following environment variables may affect the execution of pack:
LANG
Provide a default value for the internationalisation variables that are unset or null. If LANG is unset or null, the corresponding value from the implementation-dependent default locale will be used. If any of the internationalisation variables contains an invalid setting, the utility will behave as if none of the variables had been defined.
LC_ALL
If set to a non-empty string value, override the values of all the other internationalisation variables.
LC_CTYPE
Determine the locale for the interpretation of sequences of bytes of text data as characters (for example, single- as opposed to multi-byte characters in arguments).
LC_MESSAGES
Determine the locale that should be used to affect the format and contents of diagnostic messages written to standard error, and informative messages written to standard output.
NLSPATH
Determine the location of message catalogues for the processing of LC_MESSAGES .

 ASYNCHRONOUS EVENTS

If an error or signal occurs, the file.z file is not created and the original file is unchanged.

 STDOUT

The standard output is a text file containing one line for each file packed, with the following format used in the POSIX locale:

"pack: %s: %2.1f%% Compression\n", file, <percent compression> or:


"pack: %s: no saving - file unchanged\n", file

If the - operand is specified and the internal flag is set, additional messages of unspecified format will be written to standard output as indicated in the OPERANDS section.

 STDERR

Used only for diagnostic messages.

 OUTPUT FILES

Packed files of unspecified format are created with names of the form file.z.

 EXTENDED DESCRIPTION

None.

 EXIT STATUS

The following exit values are returned:
0
Successful completion.
>0
An error occurred.

 CONSEQUENCES OF ERRORS

Default.

 APPLICATION USAGE

The amount of compression obtained depends on the size of the input file and the character frequency distribution. Because a decoding tree may form the first part of each .z file, it is usually not worthwhile to pack small files, unless the character frequency distribution is very skewed, which may occur with printer plots or pictures.

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

Packed files are not necessarily portable to other systems.

Applications should migrate to the compress utility. The compress utility offers two advantages over pack:

 EXAMPLES

None.

 FUTURE DIRECTIONS

None.

 SEE ALSO

pcat, unpack, compress.

UNIX ® is a registered Trademark of The Open Group.
Copyright © 1997 The Open Group
[ Main Index | XSH | XCU | XBD | XCURSES | XNS ]