File directory Compression/Decompression
File compression/decompression------GZIP/BZIP2/XZ
1) gzip *.gz
Compression:
[Email protected] ~]# Gzip/file/1.txt
[Email protected] ~]# file/file/1.txt.gz
/file/1.txt.gz:gzip compressed data, was ' 1.txt ', from Unix, last Modified:mon Apr 10 15:22:52 2017
Unzip:
[Email protected] ~]# gzip-d/file/1.txt.gz
2) bzip2 *.bz2
[Email protected] ~]# Bzip2/file/2.txt
[Email protected] ~]# file/file/2.txt.bz2
/FILE/2.TXT.BZ2:BZIP2 compressed data, block size = 900k
[Email protected] ~]#
[Email protected] ~]# bzip2-d/file/2.txt.bz2
3) XZ *.xz
[Email protected] ~]# Xz/file/3.txt
[Email protected] ~]# FILE/FILE/3.TXT.XZ
/FILE/3.TXT.XZ:XZ Compressed data
[Email protected] ~]# xz-d/FILE/3.TXT.XZ
Create a packaged file---tar
1) Create a packaged file *.tar
# Tar CF package file name source file
C:create Create
F:file file
[Email protected] ~]# tar cf/bak/file01.tar/file/
2) Unpacking
# Tar XF package file name [-C directory name]
[Email protected] ~]# tar Xf/bak/file01.tar
[Email protected] ~]# tar xf/bak/file01.tar-c/tmp/
3) View the files in the package
[Email protected] ~]# tar Tvf/bak/file01.tar
Call gzip for compression/decompression
# tar Czf package file name source file
Z: Call gzip
[Email protected] ~]# tar czf/bak/etc02.tar.gz/etc/
[Email protected] ~]# tar czf/bak/etc-$ (date +%f). tar.gz/etc/
Unzip:
# tar Xzf package file name [-C directory name]
[Email protected] ~]# tar zxf/bak/etc02.tar.gz-c/tmp/
Call bzip2 for compression/decompression
# tar CJF package file name Directory name
J: Call Bzip2
[Email protected] ~]# tar cjf/bak/etc03.tar.bz2/etc/
Unzip:
# tar XJF package file name [-C directory name]
[Email protected] ~]# tar xjf/bak/etc03.tar.bz2-c/tmp/
Call XZ for compression/decompression
# tar CJF package file name Directory name
J: Call XZ
[Email protected] ~]# tar cjf/bak/etc04.tar.xz/etc/
Unzip:
# tar XJF package file name [-C directory name]
[Email protected] ~]# tar xjf/bak/etc03.tar.xz-c/tmp/
This article is from the "lyw666" blog, make sure to keep this source http://lyw666.blog.51cto.com/12823216/1957550
Use of compression and packaging under Linux