📄 gzip.texi
字号:
is read from or written to a terminal. If the input data is not ina format recognized by @code{gzip}, and if the option --stdout is alsogiven, copy the input data without change to the standard ouput: let@code{zcat} behave as @code{cat}. If @samp{-f} is not given, andwhen not running in the background, @code{gzip} prompts to verifywhether an existing file should be overwritten.@item --help@itemx -hPrint an informative help message describing the options then quit.@item --list@itemx -lFor each compressed file, list the following fields:@examplecompressed size: size of the compressed fileuncompressed size: size of the uncompressed fileratio: compression ratio (0.0% if unknown)uncompressed_name: name of the uncompressed file@end exampleThe uncompressed size is given as @samp{-1} for files not in @code{gzip}format, such as compressed @samp{.Z} files. To get the uncompressed size forsuch a file, you can use:@examplezcat file.Z | wc -c@end exampleIn combination with the --verbose option, the following fields are alsodisplayed:@examplemethod: compression method (deflate,compress,lzh,pack)crc: the 32-bit CRC of the uncompressed datadate & time: time stamp for the uncompressed file@end exampleThe crc is given as ffffffff for a file not in gzip format.With --verbose, the size totals and compression ratio for all filesis also displayed, unless some sizes are unknown. With --quiet,the title and totals lines are not displayed.@item --license@itemx -LDisplay the @code{gzip} license then quit.@item --no-name@itemx -nWhen compressing, do not save the original file name and time stamp bydefault. (The original name is always saved if the name had to betruncated.) When decompressing, do not restore the original file nameif present (remove only the @code{gzip}suffix from the compressed file name) and do not restore the originaltime stamp if present (copy it from the compressed file). This optionis the default when decompressing.@item --name@itemx -NWhen compressing, always save the original file name and time stamp; thisis the default. When decompressing, restore the original file name andtime stamp if present. This option is useful on systems which havea limit on file name length or when the time stamp has been lost aftera file transfer.@item --quiet@itemx -qSuppress all warning messages.@item --recursive@itemx -rTravel the directory structure recursively. If any of the file namesspecified on the command line are directories, @code{gzip} will descendinto the directory and compress all the files it finds there (ordecompress them in the case of @code{gunzip}).@item --suffix @var{suf}@itemx -S @var{suf}Use suffix @samp{@var{suf}} instead of @samp{.gz}. Any suffix can begiven, but suffixes other than @samp{.z} and @samp{.gz} should beavoided to avoid confusion when files are transferred to other systems.A null suffix forces gunzip to try decompression on all given filesregardless of suffix, as in:@examplegunzip -S "" * (*.* for MSDOS)@end examplePrevious versions of gzip used the @samp{.z} suffix. This was changed toavoid a conflict with @code{pack}.@item --test@itemx -tTest. Check the compressed file integrity.@item --verbose@itemx -vVerbose. Display the name and percentage reduction for each file compressed.@item --version@itemx -VVersion. Display the version number and compilation options, then quit.@item --fast@itemx --best@itemx -@var{n}Regulate the speed of compression using the specified digit @var{n},where @samp{-1} or @samp{--fast} indicates the fastest compressionmethod (less compression) and @samp{--best} or @samp{-9} indicates theslowest compression method (optimal compression). The defaultcompression level is @samp{-6} (that is, biased towards high compression atexpense of speed).@end table@node Advanced usage, Environment, Invoking gzip, Top@chapter Advanced usage@cindex concatenated filesMultiple compressed files can be concatenated. In this case,@code{gunzip} will extract all members at once. If one member isdamaged, other members might still be recovered after removal of thedamaged member. Better compression can be usually obtained if allmembers are decompressed and then recompressed in a single step.This is an example of concatenating @code{gzip} files:@examplegzip -c file1 > foo.gzgzip -c file2 >> foo.gz@end exampleThen@examplegunzip -c foo@end exampleis equivalent to@examplecat file1 file2@end exampleIn case of damage to one member of a @samp{.gz} file, other members canstill be recovered (if the damaged member is removed). However,you can get better compression by compressing all members at once:@examplecat file1 file2 | gzip > foo.gz@end examplecompresses better than@examplegzip -c file1 file2 > foo.gz@end exampleIf you want to recompress concatenated files to get better compression, do:@examplezcat old.gz | gzip > new.gz@end exampleIf a compressed file consists of several members, the uncompressedsize and CRC reported by the @samp{--list} option applies to the last memberonly. If you need the uncompressed size for all members, you can use:@examplezcat file.gz | wc -c@end exampleIf you wish to create a single archive file with multiple members sothat members can later be extracted independently, use an archiver suchas @code{tar} or @code{zip}. GNU @code{tar} supports the @samp{-z}option to invoke @code{gzip} transparently. @code{gzip} is designed as acomplement to @code{tar}, not as a replacement.@node Environment, Tapes, Advanced usage, Top@chapter Environment@cindex EnvironmentThe environment variable @code{GZIP} can hold a set of default options for@code{gzip}. These options are interpreted first and can be overwritten byexplicit command line parameters. For example:@examplefor sh: GZIP="-8v --name"; export GZIPfor csh: setenv GZIP "-8v --name"for MSDOS: set GZIP=-8v --name@end exampleOn Vax/VMS, the name of the environment variable is @code{GZIP_OPT}, toavoid a conflict with the symbol set for invocation of the program.@node Tapes, Problems, Environment, Top@chapter Using @code{gzip} on tapes@cindex tapesWhen writing compressed data to a tape, it is generally necessary to padthe output with zeroes up to a block boundary. When the data is read andthe whole block is passed to @code{gunzip} for decompression,@code{gunzip} detects that there is extra trailing garbage after thecompressed data and emits a warning by default. You have to use the@samp{--quiet} option to suppress the warning. This option can be set in the@code{GZIP} environment variable, as in:@examplefor sh: GZIP="-q" tar -xfz --block-compress /dev/rst0for csh: (setenv GZIP "-q"; tar -xfz --block-compress /dev/rst0)@end exampleIn the above example, @code{gzip} is invoked implicitly by the @samp{-z}option of GNU @code{tar}. Make sure that the same block size (@samp{-b}option of @code{tar}) is used for reading and writing compressed data ontapes. (This example assumes you are using the GNU version of@code{tar}.)@node Problems, Concept Index, Tapes, Top@chapter Reporting Bugs@cindex bugsIf you find a bug in @code{gzip}, please send electronic mail to@w{@samp{jloup@@chorus.fr}} or, if this fails, to@w{@samp{bug-gnu-utils@@prep.ai.mit.edu}}. Include the version number,which you can find by running @w{@samp{gzip -V}}. Also include in yourmessage the hardware and operating system, the compiler used to compile@code{gzip},a description of the bug behavior, and the input to @code{gzip} that triggeredthe bug.@refill@node Concept Index, , Problems, Top@unnumbered Concept Index@printindex cp@contents@bye
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -