Reprinted from: https://blog.csdn.net/zdyueguanyun/article/details/51283524
Reprinted from: http://www.cnblogs.com/xiehy/archive/2010/09/13/1824776.html
1. Compression command:
Command format: tar -zcvf compressed file name.tar.gz compressed file name
You can switch to the current directory first. Both the compressed file name and the compressed file name can be added to the path.
2. Unzip command:
Command format: tar -zxvf compressed filename.tar.gz
The unzipped files can only be placed in the current directory.
3. How to decompress the tar.bz2 file under Linux
Unzip in linux with the following command
tar jxvf filename.tar.bz2
compression
- tar –cvf jpg.tar *.jpg Packs all jpg files in the directory into tar.jpg
- tar –czf jpg.tar.gz *.jpg After packaging all jpg files in the directory into jpg.tar, and compressing it with gzip, a gzip compressed package is generated, named jpg.tar.gz
- tar –cjf jpg.tar.bz2 *.jpg After packaging all jpg files in the directory into jpg.tar, and compressing it with bzip2, a bzip2 compressed package is generated, named jpg.tar.bz2
- tar –cZf jpg.tar.Z *.jpg After packaging all jpg files in the directory into jpg.tar, and compressing it with compress, a umcompress compressed package is generated, named jpg.tar.Z
- rar a jpg.rar *.jpg rar format compression, you need to download rar for linux first
- zip jpg.zip *.jpg zip format compression, you need to download zip for linux first
decompress
- tar –xvf file.tar to decompress the tar file
- tar -xzvf file.tar.gz 解压 tar.gz
- tar -xjvf file.tar.bz2 解压 tar.bz2
- tar –xZvf file.tar.Z decompress tar.Z
- unrar e file.rar depressurar
- unzip file.zip unzip zip