compress [ -c ] [ -C ] [ -d ] [ -F ] [ -f ] [ -n ] [ -q ] [ -v ] [ -V ] [ -b Bits ] [ File ... ]
The compress command compresses data, using adaptive Lempel-Zev coding to reduce the size of files. Each original file specified by the File parameter is replaced when possible by a compressed file with a .Z appended to its name. The compressed file retains the same ownership, modes, and modification time of the original file. If no files are specified, the standard input is compressed to the standard output. If compression does not reduce the size of a file, a message is written to standard error and the original file is not replaced.
Note: Files must have correct permissions to be replaced.
The amount of compression depends on the size of the input, the number of bits per code specified by the Bits variable, and the distribution of common substrings. Typically, source code or English text is reduced by 50 to 60%. The compression of the compress command is usually more compact and takes less time to compute than the compression achieved by Huffman coding (as used in the pack command) or adaptive Huffman coding.
File | Specifies the file to compress. |
If an error occurs, the exit status is 1. If the compress command exits without compressing a file, it exits with a status of 2. Otherwise, the compress command exits with a status of 0.
The compress command detects an error and exits with a status of 1 if any of the following events occur:
0 | Successful completion. |
1 | An error occurred. |
2 | One or more files were not compressed because they would have increased in size (and the -f flag was not specified). |
>2 | An error occurred. |
To compress the foo file and write the percentage of compression to standard error, enter:
compress -v foo
The foo file is compressed and renamed foo.Z.
The compress command uses the modified Lempel-Zev algorithm described in "A Technique for High Performance Data Compression," Welch, Terry A. IEEE Computer, vol. 17, no. 6 (June 1984), pp. 8-19.
The pack command, uncompress command, unpack command, zcat command.
Commands Overview in AIX Version 4.3 System User's Guide: Operating System and Devices.