Compression and decompression
1 gzip
Gzip test.py #压缩后为test. py.gz
gzip-d test.py.gz #解压文件
2 bzip2
Bzip2 test.py #压缩后为test. py.bz2
bzip2-d test.py.gz #解压文件
3 tar
Options content
-C Create a packaged file
-R append file to packaged document
-T list packaged content
-f Specifies the package name
-j compressed by bzip2 format after packaging
-Z Compression after packaging with gzip format
-X Unpacking file
-C Specify the decompression path
--delete removing a file from a packaged file
--remove-files Delete source files after packaging
Instance:
TAR-CF test.tar/home/#将home目录打包为test. Tar
Tar-czf test.tar.gz/home/#将home目录打包并压缩为test. tar.gz
TAR-ZXF test.tar.gz #将gz文件解压
TAR-CJF test.tar.bz2/home/#将home目录打包并压缩为test. tar.bz2
TAR-JXF test.tar.bz2-c/tmp/#将bz2文件解压到指定目录
Tar-f test.tar-r test.txt #将test. txt Append to package
Tar--delete game.txt-f test.tar #从打包文件中删除game. txt
This article is from the "Practical Linux knowledge and Skills sharing" blog, please be sure to keep this source http://superleedo.blog.51cto.com/12164670/1886181
Linux packaged compression unzip tar, gzip, bzip2