Use of compression and packaging under Linux

Source: Internet
Author: User
Tags bz2

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.