Библиотека сайта rus-linux.net
There are two main compression utilities used in GNU/Linux. It's normal to first “tar” a bunch of files (using the tar program of course) and then compress them with either bzip2 or gzip. Of course either of these tools could be used without tar, although they are not designed to work on more than one file (they use the UNIX tools philosophy, let tar group the files, they will do the compression...this simplifies their program). It's normal to use tar and then use these tools on them, or use tar with the correct options to use these compression programs.
gzip is the GNU zip compression program and probably the most common compression format on UNIX-like operating systems.
This will compress a tar archive with GNU zip, usually with a .gz extension. Gzip can compress any type of file, it doesn't have to be a tar archive.
This will decompress a gzipped file, and leave the contents in the current directory.
bzip2 is a newer compression program taht offers superior compression to gzip at the cost of more processor time.
This will compress a tar archive with the bzip2 compression program, usually with a .bz extension. bzip2 can compress any type of file, it doesn't have to be a tar archive.
This will decompress a file compressed by bzip2, and leave the contents in the current directory.
Use zipinfo to find detailed information about a zip archive (the ones usually generally used by ms-dos and windows, for example winzip).
Will run grep to look for files within a zip file (ms-dos style, for example winzip) without manually decompressing the file first.
zipgrep pattern zip_file.zip
Used to recover files from a damaged bzip2 archive. It simply extracts out all the working blocks as there own bzip2 archives, you can than use bzip2 -t on each file to test the integrity of them and extract the working files.
Will convert a file that is zipped or gzipped to a file compressed using bzip2.
Both gzip and bzip2 supply tools to work within compressed files for example listing the files within the archive, running less on them, using grep to find files within the archive et cetera.
For gzip the commands are prefixed with z, zcat, zless, zgrep.
For bzip2 the commands are prefixed with bz, bzcat, bzless, bzgrep.