1 COMPRESS(1) User Commands COMPRESS(1) 2 3 4 5 NAME 6 compress, uncompress, zcat - compress, uncompress files or display 7 expanded files 8 9 SYNOPSIS 10 compress [-fv/] [-b bits] [file]... 11 12 13 compress -c [-fv] [-b bits] [file] 14 15 16 uncompress [-fv] [-c | -/] [file]... 17 18 19 zcat [file]... 20 21 22 DESCRIPTION 23 compress 24 The compress utility attempts to reduce the size of the named files by 25 using adaptive Lempel-Ziv coding. Except when the output is to the 26 standard output, each file is replaced by one with the extension .Z, 27 while keeping the same ownership modes, change times and modification 28 times, ACLs, and extended attributes. The compress utility also 29 attempts to set the owner and group of file.Z to the owner and group of 30 file, but does not fail if this cannot be done. If appending the .Z to 31 the file pathname would make the pathname exceed 1023 bytes, the 32 command fails. If no files are specified, the standard input is 33 compressed to the standard output. 34 35 36 The amount of compression obtained depends on the size of the input, 37 the number of bits per code, and the distribution of common substrings. 38 Typically, text such as source code or English is reduced by 50-60%. 39 Compression is generally much better than that achieved by Huffman 40 coding (as used in pack(1)) and it takes less time to compute. The bits 41 parameter specified during compression is encoded within the compressed 42 file, along with a magic number to ensure that neither decompression of 43 random data nor recompression of compressed data is subsequently 44 allowed. 45 46 uncompress 47 The uncompress utility restores files to their original state after 48 they have been compressed using the compress utility. If no files are 49 specified, the standard input is uncompressed to the standard output. 50 51 52 This utility supports the uncompressing of any files produced by 53 compress. For files produced by compress on other systems, uncompress 54 supports 9- to 16-bit compression (see -b). 55 56 zcat 57 The zcat utility writes to standard output the uncompressed form of 58 files that have been compressed using compress. It is the equivalent of 59 uncompress -c. Input files are not affected. 60 61 OPTIONS 62 The following options are supported: 63 64 -b bits 65 Sets the upper limit (in bits) for common substring codes. 66 bits must be between 9 and 16 (16 is the default). Lowering 67 the number of bits result in larger, less compressed files. 68 69 70 -c 71 Writes to the standard output; no files are changed and no 72 .Z files are created. The behavior of zcat is identical to 73 that of `uncompress -c'. 74 75 76 -f 77 When compressing, forces compression of file, even if it 78 does not actually reduce the size of the file, or if the 79 corresponding file.Z file already exists. 80 81 If the -f option is not specified, and the process is not 82 running in the background, prompts to verify whether an 83 existing file should be overwritten. If the response is 84 affirmative, the existing file is overwritten. When 85 uncompressing, does not prompt for overwriting files. If the 86 -f option is not specified, and the process is not running 87 in the background, prompts to verify whether an existing 88 file should be overwritten. If the standard input is not a 89 terminal and -f is not specified, writes a diagnostic 90 message to standard error and exits with a status greater 91 than 0. 92 93 94 -v 95 Verbose. Writes to standard error messages concerning the 96 percentage reduction or expansion of each file. 97 98 99 -/ 100 When compressing or decompressing, copies any extended 101 system attributes associated with the source file to the 102 target file and copies any extended system attributes 103 associated with extended attributes of the source file to 104 the corresponding extended attributes associated with the 105 target file. If any extended system attributes cannot be 106 copied, the original file is retained, a diagnostic is 107 written to stderr, and the final exit status is non-zero. 108 109 110 OPERANDS 111 The following operand is supported: 112 113 file 114 A path name of a file to be compressed by compress, 115 uncompressed by uncompress, or whose uncompressed form is 116 written to standard out by zcat. If file is -, or if no file is 117 specified, the standard input is used. 118 119 120 USAGE 121 See largefile(5) for the description of the behavior of compress, 122 uncompress, and zcat when encountering files greater than or equal to 2 123 Gbyte (2^31 bytes). 124 125 ENVIRONMENT VARIABLES 126 See environ(5) for descriptions of the following environment variables 127 that affect the execution of compress, uncompress, and zcat: LANG, 128 LC_ALL, LC_COLLATE, LC_CTYPE, LC_MESSAGES, and NLSPATH. 129 130 131 Affirmative responses are processed using the extended regular 132 expression defined for the yesexpr keyword in the LC_MESSAGES category 133 of the user's locale. The locale specified in the LC_COLLATE category 134 defines the behavior of ranges, equivalence classes, and multi- 135 character collating elements used in the expression defined for 136 yesexpr. The locale specified in LC_CTYPE determines the locale for 137 interpretation of sequences of bytes of text data a characters, the 138 behavior of character classes used in the expression defined for the 139 yesexpr. See locale(5). 140 141 EXIT STATUS 142 The following error values are returned: 143 144 0 145 Successful completion. 146 147 148 1 149 An error occurred. 150 151 152 2 153 One or more files were not compressed because they would have 154 increased in size (and the -f option was not specified). 155 156 157 >2 158 An error occurred. 159 160 161 ATTRIBUTES 162 See attributes(5) for descriptions of the following attributes: 163 164 165 166 167 +--------------------+-------------------+ 168 | ATTRIBUTE TYPE | ATTRIBUTE VALUE | 169 +--------------------+-------------------+ 170 |CSI | Enabled | 171 +--------------------+-------------------+ 172 |Interface Stability | Committed | 173 +--------------------+-------------------+ 174 |Standard | See standards(5). | 175 +--------------------+-------------------+ 176 177 SEE ALSO 178 ln(1), pack(1), fgetattr(3C), fsetattr(3C), attributes(5), environ(5), 179 largefile(5), locale(5), standards(5) 180 181 DIAGNOSTICS 182 Usage: compress [-fv/] [-b maxbits] [file... ] 183 compress c [-fv] [-b maxbits] [file] 184 185 Invalid options were specified on the command line. 186 187 188 Usage: uncompress [-fv] [-c | -/] [file]... 189 190 Invalid options were specified on the command line. 191 192 193 Missing maxbits 194 195 Maxbits must follow -b, or invalid maxbits, not a numeric value. 196 197 198 file: not in compressed format 199 200 The file specified to uncompress has not been compressed. 201 202 203 file: compressed with xxbits, can only handle yybits 204 205 file was compressed by a program that could deal with more bits 206 than the compress code on this machine. Recompress the file with 207 smaller bits. 208 209 210 file: already has .Z suffix -- no change 211 212 The file is assumed to be already compressed. Rename the file and 213 try again. 214 215 216 file already exists; do you wish to overwrite (yes or no)? 217 218 Respond y if you want the output file to be replaced; n if not. 219 220 221 uncompress: corrupt input 222 223 A SIGSEGV violation was detected, which usually means that the 224 input file is corrupted. 225 226 227 Compression:xx.xx% 228 229 Percentage of the input saved by compression. (Relevant only for 230 -v.) 231 232 233 - - not a regular file: unchanged 234 235 When the input file is not a regular file, (such as a directory), 236 it is left unaltered. 237 238 239 - - has xx other links: unchanged 240 241 The input file has links; it is left unchanged. See ln(1) for more 242 information. 243 244 245 - - file unchanged 246 247 No savings are achieved by compression. The input remains 248 uncompressed. 249 250 251 - -filename too long to tack on .Z 252 253 The path name is too long to append the .Z suffix. 254 255 256 - -cannot preserve extended attributes. file unchanged 257 258 Extended system attributes could not be copied. 259 260 261 NOTES 262 Although compressed files are compatible between machines with large 263 memory, -b 12 should be used for file transfer to architectures with a 264 small process data space (64KB or less). 265 266 267 compress should be more flexible about the existence of the .Z suffix. 268 269 270 271 February 5, 2020 COMPRESS(1)