How to decompress .tar files in Linux
1. Pack and compress
tar -cvf etc.tar /app/etc #package tar -zcvf pack.tar.gz pack/ #Pack and compress into a compressed package in .gz format tar -jcvf pack.tar.bz2 pack/ #Pack and compress into a compressed package in .bz2 format tar -Jcvf pack.tar.xz pack/ #Pack and compress into a compressed package in .xz format
2. Unpack and decompress
tar -xvf pack.tar # unpack pack.tar file tar -zxvf pack.tar.gz /pack #Unpack and decompress the compressed package in .gz format to the pack folder tar -jxvf pack.tar.bz2 /pack #Unpack and decompress the compressed package in .bz2 format to the pack folder tar -Jxvf pack.tar.xz /pack #Unpack and decompress the compressed package in .xz format to the pack folder
Key explanation: the tar tool itself does not have the function of compression, and it can only be realized by combining the compression tool Better compression.
-j: bzip2
-z: gzip
-J: xz
-c: Packaging
-x: Unpacking
Recommended study: Linux video tutorial
The above is the detailed content of how to decompress .tar files in Linux, please pay attention to more 1024programmer.com Other related articles!