Unzip command for file directory
File directory compression / decompression
File compression / decompression-gzip/bzip/xz
1) gzip * .gz
Compression:
[root@localhost ~] # gzip / bbq/1.txt
[root@localhost ~] # ls / bbq/
1.txt.gz
[root@localhost ~] # file / bbq/1.txt.gz
/ bbq/1.txt.gz: gzip compressed data, was "1.txt", from Unix, last modified: Sat Sep 7 05:33:50 2019
Unzip:
[root@localhost] # gzip-d / bbq/1.txt
[root@localhost ~] # ls / bbq/
1.txt
2) bzip2 * .bz2
[root@localhost ~] # bzip2 / bbq/1.txt
[root@localhost ~] # file / bbq/1.txt.bz2
/ bbq/1.txt.bz2: bzip2 compressed data, block size = 900k
[root@localhost] # bzip2-d / bbq/1.txt.bz2
[root@localhost ~] # ls / bbq/
1.txt
3) xz * .xz
[root@localhost ~] # xz / bbq/1.txt
[root@localhost ~] # file / bbq/1.txt.xz
/ bbq/1.txt.xz: XZ compressed data
[root@localhost] # xz-d / bbq/1.txt.xz
[root@localhost ~] # ls / bbq/
1.txt
Create a package file-tar
1) create a package file * .tar
Tar cf package file name source file c: create create f: file file
[root@localhost bbq] # tar cf 1.tar 1.txt
[root@localhost bbq] # file 1.tar
1.tar: POSIX tar archive (GNU)
2) unpack
# tar xf package file name [- C directory name]
[root@localhost bbq] # tar xf 1.tar
[root@localhost bbq] # tar xf 1.tar-C / kvm/
3) View the files in the package
[root@localhost bbq] # tar tvf 1.tar
-rw-r--r-- root/root 0 2019-09-07 05:33 1.txt
Call gzip to compress / decompress beforehand
# tar czf package File name Source File
Z: call gzip
[root@localhost bbq] # tar czf / kvm/1.tar.gz / bbq/
[root@localhost bbq] # ls / kvm
1.tar.gz
Decompress
[root@localhost] # tar zxf / kvm/1.tar.gz-C / tmp/
Call bzip2 to achieve compression / decompression
# tar cjf package file name directory name
J: call bzip2
[root@localhost ~] # tar cjf / kvm/1.tar.bz2 / kvm/
Decompress
[root@localhost] # tar xjf / kvm/1.tar.bz2-C / tmp/
Call xz to achieve compression / decompression
Tar cJf package file name directory name J: call xz