Tar common options
-C (Create) represents the creation of a package used to generate a file
-X: Extract, extract file from package
-T to view compressed files.
-Z is processed using gzip, which is combined with "C" to represent compression, which is combined with "X" to represent decompression.
-j is processed using BZIP2 mode, which is combined with "C" to represent compression, and "X" is used to represent the decompression.
-V (verbose) detailed report on tar processing information
-F (file) represents the document followed by a filename.
-c < Specify directory > extract to specified directory
1.tar Packaging, gzip compression
1) compression
TAR-CZVF compressed file name Directory name
such as: Tar czvf dira.tar.gz dira
Attention:
TAR-CZVF and tar czvf are the same effect, so say, after the unification is canceled-.
2) View
Tar TVF Compressed file name
such as: Tar TVF dira.tar.gz
3) Unzip
Tar xzvf Compressed file name
Tar xzvf compressed file name-C specified directory
such as: Tar XZVF dira.tar.gz extract to the current directory
such as: Tar xzvf dira.tar.gz-c/home/book extract to/home/book
2.tar Packaging, bzip2 compression
1) compression
Tar cjvf compressed file name Directory name
such as: Tar cjvf dira.tar.bz2 dira
2) View
Tar TVF Compressed file name
such as: Tar TVF dira.tar.bz2
3) Unzip
Tar xjvf Compressed file name
Tar xjvf compressed file name-C specified directory
such as: Tar XJVF dira.tar.bz2 extract to the current directory
such as: Tar xjvf dira.tar.bz2-c/home/book extract to/home/book
This article from "Van Gogh said my brain is sick" blog, declined reprint!
The tar of Advanced Linux commands