Linux study notes (five) Liunx commonly used commands: compress command

Linux is the most common compression format 5:

  • zip
  • gz
  • bz2
  • tar.gz
  • tar.bz2

A, .zip compression command

Compressed file

zip [archive name] [source file]

For example:  ZIP zijeak.zip zijeak 

Note: linux does not distinguish between the file extension, but convenient for people to read, when creating a compressed file, compressed suffix must bring

Compression directory

zip -r [archive name] [source file]

For example:  ZIP -r zijeak.zip zijeak 

unzip

unzip [archive]

For example:  the unzip zijeak.zip 

Two, .gz compression command

Compressed file

the gzip [source]

.Gz suffix compression for the compressed file, the compressed source files will disappear

gzip -c [source]> [archive]

Keeping your source files

gzip -r [directory]

Compress all subfolders in the directory, but the directory can not be compressed

 

unzip

(1) gzip -d [archive]

(2) gunzip [archive]

De-compressed file with multiple commands can compress, decompress batches

Three, .bz2 compression

Compressed file

bzip2 [source]

.Bz2 compressed file format, does not retain the original file

bzip2 -k [source]

Note: bzip2 command does not compress directory

 

unzip

bzip2 -d [archive]

-k reserved compressed files

bunzip2 [archive]

-k reserved compressed files

 

Four, .tar.gz .tar.bz2 format compression format compression

Compressed file

tar -cvf [package filename] [source file]

package -c

-v display process

-f specifies the file name of the package

-z compression format is .tar.gz

-j .tar.bz2 compressed format

For example   tar -cvf zijeak.tar zijeak 

Then you can use the command gzip or bzip2 compression format is .tar.gz or .tar.bz2

unzip

tar -xvf [package filename]

-x solution package

-z unzip the .tar.gz format

-j decompress .tar.bz2 format

-t test, just to see, do not unpack

 tar jxvf zijeak.tar.bz2 -C / temp / 

-C specifies unzipped

 

Guess you like

Origin www.cnblogs.com/zijeak/p/11297657.html