Excellent software and practical tutorials
In daily Linux operations,UnzipThe file is essential. The usual tar.gz is very common, sometimes you will encounterbz2Or 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.bz2
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