You are here: >

Linux and Unix unpack command

unpack commandAbout unpack
unpack syntax
unpack examples
Related commands
Linux and Unix main page

About unpack

Warning! The pack and unpack utilities are no longer used on modern systems. If you need to work with files compressed with pack, use the gzip utility, which can automatically detect and decompress files that use pack compression.

Although now obsolete, unpack was the utility used to expand a file that was compressed with the pack utility. It is documented here for historical reasons.

unpack syntax

unpack file

Description

The unpack command expands files created by pack. For each file specified in the command, a search is made for a file called file.z (or just file, if file ends in .z). If this file appears to be a packed file, it is replaced by its expanded version. The new file has the .z suffix stripped from its name, and has the same access modes, access and modification dates, and owner as those of the packed file.

unpack returns a value that is the number of files it was unable to unpack. Failure may occur for the same reasons that it may in pcat, as well as for the following:

  • a file with the "unpacked" name already exists;
  • the unpacked file cannot be created;
  • the filename (excluding the .z extension) has more than 14 bytes. (this shows you how antiquated unpack is!)

unpack examples

unpack myfile.txt.z

Unpack the file myfile.txt.z into the file myfile.txt.

cat — Output the contents of a file.
compress — Compress a file or files.
pack — Compress files using a Huffman algorithm.
pcat — Print the uncompressed contents of a compressed file.
unpack — Expand a compressed file.
zcat — Print the uncompressed contents of compressed files.