Compression and decompression of bz2 format

In daily Linux operations, decompressing files is essential. The usual tar.gz is very common, and sometimes you will encounter bz2 or rar or zip formats. Teach you how to decompress these file formats.

In daily Linux operations,The file is essential. The usual tar.gz is very common, sometimes you will encounterOr rar or zip format. Teach you how to decompress these file formats.
Unzip the files:
Unzip:.tar

tar –xvf

Unzip: .gz

gzip -d

or

gunzip

Unzip:.tar.gz and.tgz

tar –xzf

Unzip:.bz2

bzip2 -d

or

bunzip2

Unzip: .

tar –xjf

Unzip:.Z

uncompress

Unzip: .tar.Z

tar –xZf

Unzip:.rar

unrar

Unzip: .zip

unzip

Compressed files:
Package all jpg files in the directory into tar.jpg:

tar –cvf jpg.tar *.jpg

After packaging all the jpg files in the directory into jpg.tar, compress them with gzip to generate a gzip compressed package named jpg.tar.gz:

tar –czf jpg.tar.gz *.jpg

After packaging all the jpg files in the directory into jpg.tar, compress them with bzip2 to generate a bzip2 compressed package named jpg.tar.bz2:

tar –cjf jpg.tar.bz2 *.jpg

After packaging all the jpg files in the directory into jpg.tar, compress them with compress to generate a umcompressed package named jpg.tar.Z:

tar –cZf jpg.tar.Z *.jpg

To compress in rar format, you need to download rar for linux first:

rar a jpg.rar *.jpg

For compression in zip format, you need to download zip for linux first:

zip jpg.zip *.jpg

For more detailed information about rar and zip methods, please visit:How to decompress RAR and ZIP files under CentOS

1/5 - (1 vote)

Leave a Reply

Your email address will not be published. Required fields are marked *