compress 中文man页面

系统
compress是个历史悠久的压缩程序,文件经它压缩后,其名称后面会多出".Z"的扩展名。当要解压缩时,可执行uncompress指令。事实上uncompress是指向compress的符号连接,因此不论是压缩或解压缩,都可通过compress指令单独完成。

功能说明:压缩或解压文件。

语法:compress[-cdfrvV][-b<压缩效率>][文件或目录...]

补充说明:compress是个历史悠久的压缩程序,文件经它压缩后,其名称后面会多出".Z"的扩展名。当要解压缩时,可执行uncompress指令。事实上uncompress是指向compress的符号连接,因此不论是压缩或解压缩,都可通过compress指令单独完成。

参数

-b<压缩效率>压缩效率是一个介于9-16的数值,预设值为"16",指定愈大的数值,压缩效率就愈高。

-c把压缩后的文件输出到标准输出设备,不去更动原始文件。

-d对文件进行解压缩而非压缩。

-f强制保存压缩文件,不理会文件名称或硬连接是否存在,该文件是否为符号连接以及压缩效率高低的问题。

-r递归处理,将指定目录下的所有文件及子目录一并处理。

-v显示指令执行过程。

-V显示指令版本及程序预设值。

#p#

NAME

compress, uncompress, zcat - compress and expand data (version 4.1)  

SYNOPSIS

compress [ -f ] [ -v ] [ -c ] [ -V ] [ -r ] [ -b bits ] [ name ... ]
uncompress [ -f ] [ -v ] [ -c ] [ -V ] [ name ... ]
zcat [ -V ] [ name ... ]  

DESCRIPTION

Compress reduces the size of the named files using adaptive Lempel-Ziv coding. Whenever possible, each file is replaced by one with the extension .Z, while keeping the same ownership modes, access and modification times. If no files are specified, the standard input is compressed to the standard output. Compress will only attempt to compress regular files. In particular, it will ignore symbolic links. If a file has multiple hard links, compress will refuse to compress it unless the -f flag is given.

If -f is not given and compress is run in the foreground, the user is prompted as to whether an existing file should be overwritten.

Compressed files can be restored to their original form using uncompress or zcat.

uncompress takes a list of files on its command line and replaces each file whose name ends with .Z and which begins with the correct magic number with an uncompressed file without the .Z. The uncompressed file will have the mode, ownership and timestamps of the compressed file.

The -c option makes compress/uncompress write to the standard output; no files are changed.

zcat is identical to uncompress -c. zcat uncompresses either a list of files on the command line or its standard input and writes the uncompressed data on standard output. zcat will uncompress files that have the correct magic number whether they have a .Z suffix or not.

If the -r flag is specified, compress will operate recursively. If any of the file names specified on the command line are directories, compress will descend into the directory and compress all the files it finds there.

The -V flag tells each of these programs to print its version and patchlevel, along with any preprocessor flags specified during compilation, on stderr before doing any compression or uncompression.

Compress uses the modified Lempel-Ziv algorithm popularized in "A Technique for High Performance Data Compression", Terry A. Welch, IEEE Computer, vol. 17, no. 6 (June 1984), pp. 8-19. Common substrings in the file are first replaced by 9-bit codes 257 and up. When code 512 is reached, the algorithm switches to 10-bit codes and continues to use more bits until the limit specified by the -b flag is reached (default 16). Bits must be between 9 and 16. The default can be changed in the source to allow compress to be run on a smaller machine.

After the bits limit is attained, compress periodically checks the compression ratio. If it is increasing, compress continues to use the existing code dictionary. However, if the compression ratio decreases, compress discards the table of substrings and rebuilds it from scratch. This allows the algorithm to adapt to the next "block" of the file.

Note that the -b flag is omitted for uncompress, since the bits parameter specified during compression is encoded within the output, along with a magic number to ensure that neither decompression of random data nor recompression of compressed data is attempted.

The amount of compression obtained depends on the size of the input, the number of bits per code, and the distribution of common substrings. Typically, text such as source code or English is reduced by 50-60%. Compression is generally much better than that achieved by Huffman coding (as used in pack), or adaptive Huffman coding (compact), and takes less time to compute.

Under the -v option, a message is printed yielding the percentage of reduction for each file compressed.

Exit status is normally 0; if the last file is larger after (attempted) compression, the status is 2; if an error occurs, exit status is 1.  

SEE ALSO

pack(1), compact(1)  

责任编辑:韩亚珊 来源: 互联网
相关推荐

2011-08-15 10:21:09

man中文man

2011-08-24 16:48:36

man中文man

2011-08-11 16:11:49

at中文man

2011-08-25 10:21:56

man.conf中文man

2011-08-25 15:39:42

fcloseall中文man

2011-08-25 15:00:15

cfgetispeed中文man

2011-08-19 18:35:50

issue中文man

2011-08-25 17:03:51

pclose中文man

2011-08-25 17:40:25

setvbuf中文man

2011-08-23 14:21:16

poweroff中文man

2011-08-24 15:52:59

intro中文man

2011-08-23 13:40:31

2011-08-25 17:24:54

puts中文man

2011-08-25 18:34:55

ungetc中文man

2011-08-23 10:03:40

useradd中文man

2011-08-23 10:29:02

chpasswd中文man

2011-08-23 10:34:22

convertquot中文man

2011-08-23 15:39:34

rpmbuild中文man

2011-08-24 15:48:38

INSERT中文man

2011-08-25 09:40:49

UPDATE中文man
点赞
收藏

51CTO技术栈公众号