Linux / Unix compress command

Quick links

About compress
Syntax
Examples
Related commands
Linux / Unix main page

About compress

Compacts a file so that it is smaller. When compressing a file it will be replaced with a file with the extension .Z, while keeping all the same ownership modes.

Syntax

compress [-c] [-f] [-v] filenames

-cWrite to the standard output; no files are changed and no .Z files are created. The behavior of zcat is identical to that of `uncompress -c'.
-fWhen compressing, force compression of file , even if it does not actually reduce the size of the file, or if the corresponding file .Z file already exists. If the -f option is not given, and the process is not running in the background, prompt to verify whether an existing file .Z file should be overwritten. When uncompressing, do not prompt for overwriting files. If the -f option is not given, and the process is not running in the background, prompt to verify whether an existing file should be overwritten. If the standard input is not a terminal and -f is not given, write a diagnostic message to standard error and exit with a status greater than 0.
-vShows you how much the file shrank in size.
filenamesThe name of the file(s) that you wish to compress.

Examples

compress -v bigfile.exe - Would compress bigfile.exe and rename that file to bigfile.exe.Z.

Related commands

ln
uncompress
zcat