The compress utility reduces the size of files using adaptive Lempel-Ziv coding. Each file is renamed to the same name plus the extension ".Z". A file argument with a ".Z" extension will be ignored except it will cause an error exit after other arguments are processed. If compression would not reduce the size of a file, the file is ignored.
The uncompress utility restores compressed files to their original form, renaming the files by deleting the ".Z" extensions. A file specification need not include the files ".Z" extension. If a files name in its file system does not have a ".Z" extension, it will not be uncompressed and it will cause an error exit after other arguments are processed.
If renaming the files would cause files to be overwritten and the standard input device is a terminal, the user is prompted (on the standard error output) for confirmation. If prompting is not possible or confirmation is not received, the files are not overwritten.
As many of the modification time, access time, file flags, file mode, user ID, and group ID as allowed by permissions are retained in the new file.
If no files are specified or a file argument is a single dash (''), the standard input is compressed or uncompressed to the standard output. If either the input and output files are not regular files, the checks for reduction in size and file overwriting are not performed, the input file is not removed, and the attributes of the input file are not retained in the output file.
The options are as follows: