LinuxCommandLibrary

unpack

Unpack files from an archive

SYNOPSIS

unpack [-] [file ...]

PARAMETERS

file ...
    Specifies one or more files to be decompressed. Each file must be a regular file that was compressed with pack(1) and ends with the .z suffix. If successful, the original .z file is removed, and the decompressed version is created in its place.

-
    When specified as the only argument, unpack reads compressed data from standard input and writes the decompressed data to standard output. This allows for piping compressed data into unpack.

DESCRIPTION

The unpack command is a historical Unix and Linux utility used to decompress files that were previously compressed using the pack(1) command. It is designed to restore a file to its original size and content, removing the .z suffix that pack(1) typically appends to compressed files. Unlike more modern compression utilities like gzip(1) or bzip2(1), pack and unpack use a very simple Huffman coding algorithm, resulting in relatively poor compression ratios. The primary function of unpack is straightforward: for each specified file, it checks if it's a .z compressed file and, if so, decompresses it, replacing the original .z file with the expanded version. Due to its limited efficiency and the availability of superior compression algorithms, unpack (and pack) are considered obsolete and are generally not found or used on modern Linux systems.

CAVEATS

The unpack command is largely obsolete and not commonly available on modern Linux distributions. It offers significantly poorer compression ratios compared to modern alternatives like gzip, bzip2, or xz. Files compressed with pack(1) (and thus requiring unpack) are rare in contemporary use. Its functionality is very basic, primarily dealing with single files, and it lacks many features found in modern archivers.

OBSOLESCENCE AND AVAILABILITY

Due to its inefficiency and the advent of much more effective compression tools, unpack is rarely, if ever, used on modern systems. Many Linux distributions do not include pack or unpack by default, or they are only available in compatibility packages for very old archives. Users encountering .z files today typically use gunzip, which often has compatibility to decompress such files.

COMPRESSION FORMAT DISTINCTION

Files compressed with pack(1) are typically identified by a .z file extension (e.g., myfile.txt.z). This should not be confused with .Z (uppercase Z) used by compress(1), .gz used by gzip(1), .bz2 used by bzip2(1), or .xz used by xz(1). Each suffix corresponds to a different compression algorithm and requires the appropriate decompression tool.

HISTORY

The pack and unpack utilities were among the earliest file compression tools available in Unix systems, dating back to the late 1970s and early 1980s. They were standard components of System V Unix and BSD. Their purpose was to reduce file sizes for storage efficiency, particularly important in an era of limited disk space. However, they were eventually superseded by more advanced algorithms and implementations, most notably the LZW algorithm used by compress(1) and later the DEFLATE algorithm used by gzip(1). As better compression methods became prevalent, pack and unpack gradually fell out of widespread use and are now considered deprecated.

SEE ALSO

pack(1), compress(1), uncompress(1), gzip(1), gunzip(1), bzip2(1), bunzip2(1), xz(1), unxz(1)

Copied to clipboard