Extensions to common compressed file cases in the system
* gz: gzip compressed file
* Compressed file of. bz2: bzip2 program
* Compressed files of. xz: XZ program
* zip: zip program compressed files
* Z: Compressed files of compress program
* tar: The data packaged by the tar program is not compressed
* tar.gz: The data packaged by the tar program and compressed by gzip
* The data packaged by the. tar.bz2: tar program is compressed by bzip2
* The data packaged by the. tar.xz: tari program is compressed by XZ
decompression
gzip,zcat/zmore/zless,zgrep
bzip2,bzcat/bzmore/bzless,bzgrep
xz,xzcat/xzmore/xzless,xzgrep
gip: Can decode compressed files by compress, zip, gzip and other software
zcat/zmore/zless: View files
zgrep: Look up keywords
Common parameters:
- c: The compressed data is output to the screen and can be processed through data stream redirection.
- d: parameters for decompression
- t: It can be used to check the consistency of a compressed file to see if there are any errors in the file.
- v: It can display the compression ratio of the original/compressed file case and other information.
-#:# is the data, representing the compression level, -1 is the fastest, but the compression ratio is the worst, presupposed to be 6.
bzip2 private parameter:
- k: Keep the source file without deleting the original file.
xz private parameter:
- l: List information about compressed files
[root@iZ2ze38kyanwmst1qj2lojZ temp]
services
[root@iZ2ze38kyanwmst1qj2lojZ temp]
services: 79.7% -- replaced with services.gz
[root@iZ2ze38kyanwmst1qj2lojZ temp]
services.gz
[root@iZ2ze38kyanwmst1qj2lojZ temp]
-rw-r--r--. 1 root root 670293 Jun 7 2013 /etc/services
-rw-r--r-- 1 root root 136088 Jun 24 14:30 ./services.gz
[root@iZ2ze38kyanwmst1qj2lojZ temp]
[root@iZ2ze38kyanwmst1qj2lojZ temp]
services
[root@iZ2ze38kyanwmst1qj2lojZ temp]
[root@iZ2ze38kyanwmst1qj2lojZ temp]
services services.gz
[root@iZ2ze38kyanwmst1qj2lojZ temp]
total 792
-rw-r--r-- 1 root root 670293 Jun 24 14:30 services
-rw-r--r-- 1 root root 135489 Jun 24 14:33 services.gz
[root@iZ2ze38kyanwmst1qj2lojZ temp]
14:
89:http 80/tcp www www-http
tar packaging
tar: Package and compress the entire document directory
Parameters:
- c: Create a package file, which can be matched with - v to view the file name of the package being packed in the process
- t: See what filename the contents of the packaged file contain
- x: Unpackaged or decompressed, which can be unzipped with - C in a specific directory
- z: Compression / decompression with giz support, document name *. tar.gz
- j: Compression / decompression through bzip2 support, document name *. tar.bz2
- J: Compression / decompression with xz support, document name *. tar.xz
- v: In the process of compression and decompression, the file name being processed is displayed.
- f: The name of the document to be processed
- C: Unzip in a specific directory
- p: Retain the original permissions and attributes of backup data
Compressed backup: the name of the file or directory to be compressed by tar-zpcv-f filename.tar.gz
Decompression: Tar-zxv-f filename.tar.gz-C directory to be decompressed
Query: tar-ztv-f filename.tar.gz
[root@iZ2ze38kyanwmst1qj2lojZ ~]# Time tar-zpcf etc.tar.gz/etc//Backup and compress the ET directory
tar: Removing leading `/' from member names
real 0m2.459s
user 0m1.280s
sys 0m0.074s
[root@iZ2ze38kyanwmst1qj2lojZ ~]# ls
etc.tar.gz temp
[root@iZ2ze38kyanwmst1qj2lojZ ~]# Tar-ztvf etc.tar.gz//View File Names in Compressed Files
drwxr-xr-x root/root 0 2017-06-21 22:08 etc/
drwxr-xr-x root/root 0 2017-05-08 11:33 etc/prelink.conf.d/
[root@iZ2ze38kyanwmst1qj2lojZ ygy]# Tar-zxvf etc.tar.gz-C. / temp/ // decompression
......