unpack Command

Purpose

Expands files.

Syntax

unpack File ...

Description

The unpack command expands files created by the pack command. For each file specified, the unpack command searches for a file called File.z. If this file is a packed file, the unpack command replaces it by its expanded version. The unpack command names the new file name by removing the .z suffix from File. If the user has root authority, the new file has the same access modes, access and modification times, owner, and group as the original file. If the user does not have root authority, the file retains the same access modes, access time, and modification time, but acquires a new owner and group.

The unpack command operates only on files ending in .z. As a result, when you specify a file name that does not end in .z, the unpack command adds the suffix and searches the directory for a file name with that suffix.

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

  • The file name (exclusive of .z) has more than 253 bytes.
  • 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.

    Note: The unpack command writes a warning to standard error if the file it is unpacking has links. The new unpacked file has a different i-node than the packed file from which it was created. However, any other files linked to the original i-node of the packed file still exist and are still packed.

Exit Status

This command returns the following exit values:

Item Description
0 The command ran successfully.
>0 An error occurred.

Example

To unpack packed files:

unpack chap1.z chap2

This expands the packed files chap1.z and chap2.z, and replaces them with files named chap1 and chap2. Note that you can give the unpack command file names either with or without the .z suffix.

Files

Item Description
/usr/bin/unpack Contains the unpack command.