Latest web development tutorials

Linux gzip command

Linux command Daquan Linux command Daquan

Linux gzip command to compress files.

gzip is a widely used compression program, after which the files have been compressed, after the name more ".gz" extension.

grammar

gzip [-acdfhlLnNqrtvV][-S <压缩字尾字符串>][-<压缩效率>][--best/fast][文件...] 或 gzip [-acdfhlLnNqrtvV][-S <压缩字尾字符串>][-<压缩效率>][--best/fast][目录]

Parameters:

  • -a or --ascii using ASCII text mode.
  • -c or --to-stdout --stdout or the compressed file to the standard output device, not to the original file changes.
  • -d or --decompress ---- uncompress or extract the zipped files.
  • -f or --force forcibly compressed files. Ignore the file name or a hard connection exists and the file is a symbolic link.
  • -h or --help online help.
  • -l or --list List compressed files related information.
  • -L Or --license display version and copyright information.
  • -n or --no-name When compressing files, do not save the original file name and time stamp.
  • -N Or --name compressed file, save the original file name and time stamp.
  • -q or --quiet Do not display a warning message.
  • -r or --recursive recursive processing, all files and subdirectories in the specified directory be dealt with.
  • -S <Compression suffix string> or ---- suffix <compression suffix string> change the compression suffix string.
  • -t test compressed file or --test is correct.
  • -v or --verbose display during the execution of instructions.
  • -V Or --version display version information.
  • - <Compression efficiency> compression efficiency is a value between 1-9, default is "6", specify the larger the value, the compression efficiency will be higher.
  • --best effect of this parameter and specify "-9" the same parameters.
  • --fast effect of this parameter and specify "-1" parameters the same.

Examples

Compressed file

[[email protected] a]# ls //显示当前目录文件
a.c b.h d.cpp
[[email protected] a]# gzip * //压缩目录下的所有文件
[[email protected] a]# ls //显示当前目录文件
a.c.gz	b.h.gz	d.cpp.gz
[[email protected] a]# 

Example 1 pick lists details

[[email protected] a]# gzip -dv * //解压文件,并列出详细信息
a.c.gz:	 0.0% -- replaced with a.c
b.h.gz:	 0.0% -- replaced with b.h
d.cpp.gz:	 0.0% -- replaced with d.cpp
[[email protected] a]# 

Then Example 1, a compressed file information

[[email protected] a]# gzip -l *
     compressed    uncompressed ratio uncompressed_name
         24          0  0.0% a.c
         24          0  0.0% b.h
         26          0  0.0% d.cpp

Linux command Daquan Linux command Daquan