Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (OSF1-V5.1-alpha)
Apropos / Subsearch:
optional field

pack(1)								      pack(1)


  pack,	pcat, unpack - Compresses and expands files


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

  unpack file[.z]...

  pcat file[.z]...


  Interfaces documented	on this	reference page conform to industry standards
  as follows:

  pack:	XCU5.0

  pcat:	 XCU5.0

  unpack:  XCU5.0

  Refer	to the standards(5) reference page for more information	about indus-
  try standards	and associated tags.


  -   Displays statistics about	the input files. The statistics	are calcu-
      lated from a Huffman minimum redundancy code tree	built on a byte-by-
      byte basis.  Repeating the - (dash) on the command line toggles this

  -f  Forces compaction	of input files.


       These options are applicable to the pack	command	only.


      A	pathname of a file to be compressed or uncompressed.

      If the .z	suffix is included on the pack command,	pack searches for
      files without that suffix.  If the .z suffix is not included, the	files
      created have the original	name with .z appended.

      If the .z	suffix is included on a	pcat or	unpack command,	the command
      processes	files with that	name.  If the .z suffix	is not included, the
      command appends .z to the	file name.

      Files created by the unpack command will not have	the .z suffix.


  The pack command

  The pack command stores the specified	file in	a compressed form.  The	input
  file is replaced by a	packed file with a name	derived	from the original
  file name (file.z), with the ownership, modes, access	time and modification
  time of the original file preserved, if the invoking process has appropri-
  ate privileges.

  Directories cannot be	compressed.

  If pack cannot create	a smaller file,	it stops processing and	reports	that
  it is	unable to save space, unless you specify the -f	option.	 (The -f
  option forces	packing	to occur even if the files cannot benefit from pack-
  ing.)	 A failure to save space generally happens with	small files or files
  with uniform character distribution.

  The amount of	space saved 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,	you will generally not be able to save space with
  files	smaller	than three blocks.  Typically, text files are reduced 25 to
  40 percent.

  Object files,	which use a larger character set and have a more uniform dis-
  tribution of characters, show	only a 10 percent reduction when packed.

  The exit value of the	pack command is	the number of files that it could not
  pack.	 Packing is not	done under any one of the following conditions:

    +  The file	is already packed.

    +  The file	has links.

    +  The file	is a directory.

    +  The file	cannot be opened.

    +  No storage blocks are saved by packing. This is overridden by the -f

    +  A file called file.z already exists.

    +  The .z file cannot be created.

    +  An I/O error occurs during processing.

    +  The file	is empty.

  The pcat command

  The pcat command reads the specified files, unpacks them, and	writes them
  to standard output.

  The exit value of pcat is the	number of files	it was unable to unpack.  A
  file cannot be unpacked if any one of	the following occurs:

    +  The file	cannot be opened.

    +  The file	is not a packed	file.

    +  [Tru64 UNIX]  The file name (exclusive of the .z) has more than 12
       bytes and it resides on a System	V file system.

  The unpack command

  The unpack command expands files created by pack.  For each file specified,
  unpack searches for a	file called file.z.  If	this file is a packed file,
  unpack replaces it by	its expanded version.  The unpack command names	the
  new file name	by removing the	.z suffix from file.  The new file has the
  same access modes, access and	modification dates, and	owner as the original
  packed file.

  The exit value is the	number of files	the unpack command was unable to
  unpack.  A file cannot be unpacked if	any one	of the following occurs:

    +  The file	cannot be opened.

    +  The file	is not a packed	file.

    +  A file with the unpacked	file name already exists.

    +  The unpacked file cannot	be created.


  The pack, pcat and unpack utilities are marked LEGACY	in XCU Issue 5.

   1.  Both pcat and unpack operate only on files ending in .z.	 As a result,
       when you	specify	a file name that does not end in .z, pcat and unpack
       add the suffix and search the directory for a file name with that suf-

   2.  [Tru64 UNIX]  The unpack	command	writes a warning to standard output
       if the file it is unpacking has links.  The new unpacked	file has a
       different inode than the	packed file from which it was created.	How-
       ever, any other files linked to the packed file's original inode	still
       exist and are still packed.

   3.  [Tru64 UNIX]  If	pack is	used on	files residing on a System V file
       system, the file	names must contain no more than	12 bytes to allow
       space for the added .z extension.

   4.  [Tru64 UNIX]  If	you try	to use pack on a very small file, you might
       receive the following message:
	    pack filename: No saving --	file unchanged

   5.  The pack, pcat, and unpack commands are marked to be withdrawn from
       the XPG4-UNIX standard.	The compress, uncompress, and zcat commands
       should be used instead.


  The following	exit values are	returned:

  The pack command

  0   Successful completion.

  >>0  [Tru64 UNIX]  The	number of files	that could not be packed.

  The pcat command

  0   Successful completion.

  >>0  [Tru64 UNIX]  The	number of files	that could not be unpacked.

  The unpack command

  0   Successful completion.

  >>0  [Tru64 UNIX]  The	number of files	that could not be unpacked.


   1.  To compress files, enter:
	    pack chap1 chap2

       This compresses the files chap1 and chap2, replacing them with files
       named chap1.z and chap2.z.  The pack command displays the percent
       decrease	in size	for each file.

   2.  To display statistics about the amount of compression done, enter:
	    pack  -  chap1  -  chap2

       This compresses the files chap1 and chap2 and displays statistics
       about chap1, but	not about chap2. The first - (dash) turns on the
       statistic display, and the second turns it off.

   3.  To display compressed files, enter:
	    pcat  chap1.z  chap2 |  more

       This displays the compressed files chap1.z and chap2.z on the screen
       in expanded form, a page	at a time (more).  The pcat command added the
       .z to the end of	chap2, even though it was not entered.

   4.  To use a	compressed file	without	expanding the copy stored on disk,
	    pcat chap1.z  |  grep  'Greece'

       This pipes the contents of chap1.z in its expanded form to the grep

   5.  To unpack packed	files, enter:
	    unpack  chap1.z  chap2

       This expands the	packed files chap1.z and chap2.z, replacing them with
       files named chap1 and chap2. You	can give unpack	file names either
       with or without the .z suffix.


  The following	environment variables affect the execution of pack, pcat, and

      Provides a default value for the internationalization variables that
      are unset	or null. If LANG is unset or null, the corresponding value
      from the default locale is used.	If any of the internationalization
      variables	contain	an invalid setting, the	utility	behaves	as if none of
      the variables had	been defined.

      If set to	a non-empty string value, overrides the	values of all the
      other internationalization variables.

      Determines the locale for	the interpretation of sequences	of bytes of
      text data	as characters (for example, single-byte	as opposed to multi-
      byte characters in arguments).

      Determines the locale for	the format and contents	of diagnostic mes-
      sages written to standard	error.

      Determines the location of message catalogues for	the processing of


  Commands:  cat(1), compress(1), uncompress(1), zcat(1)

  Standards:  standards(5)