Linux Sub-volume compression, combined decompression of 3 ways

Source: Internet
Author: User
Tags rar

When we upload things, because the file is too large to upload, or not to upload, the most obvious is to send mail, accessories 5M, some 10M. If it's over, it's depressing. This time, if you can compress things, split up is more cool, under Windows I want you to know how to split, using Winrar,winzip to set the size of the compressed block. But there is no such method under Linux, Linux under the RAR command, there are zip commands, windows under these two ways can be split compression, I think Linux is absolutely possible under. Here are the records of the process I tried:

One, RAR volume compression and Merge decompression

Rar-h

We will find the following parameters to create how large the volume.

v             Create volumes with size autodetection or List all volumes
V<size>[k,b]   Create volumes with size =<size>*1000 [*1024, *]

[[email protected] awksed]$ rar a -v5m google.rar google_maps_api.doc  No spaces between  //-v and 5m     RAR 3.92   Copyright  (c)  1993-2010  Alexander Roshal   10 Feb 2010  Shareware version          Type RAR -? for help     Evaluation copy. Please register.    Creating archive  Google.rar    adding    google_maps_api.doc  calculating  the control sum         creating archive  google.part2.rar    ...       google_maps_api.doc   Calculating the control sum          Creating archive google.part3.rar    ...       google_maps_api.doc                                            ok  calculating the control sum  done  [[email  protected] awksed]$ unrar x google.part1.rar //Merging and unpacking      unrar 3.90 freeware      copyright  (c)  1993-2009  alexander roshal    extracting from google.part1.rar     Extracting  Google_Maps_API.doc                                                Extracting from  Google.part2.rar    ...         google_maps_ api.doc                                         76%    Extracting from google.part3.rar     ...         Google_Maps_API.doc                                         ok   all ok

Two, zip sub-volume compression and merge decompression

Zip-h2

You will find that the sub-volume parameter-s, which means dividing into how big the volume

Splits (archives created as a set of split files):
-S ssize create split archive with splits of size ssize, where ssize nm
N Number and M multiplier (KMGT, default m), 100k-KB

The following means that if it is a sub-volume, with the-s 0--out to the sub-volume synthesis of a

If input is split, output would default to same split size
Use-s=0 or-s-to turn off splitting to convert splitto single file:
Zip in_split_archive-s 0--out out_single_file_archive

When compressing with a zip, he must be a. zip of the situation, his process is such that the general file is compressed into a. zip file, and then in the. zip file into how many blocks, if you do not sit like this, will prompt the wrong.

[Zhangy@blackghost awksed]$ zip-s 4m google_maps_api.doc
Zip error:invalid command Arguments (archive name must end in. zip for splits)

[[email protected] awksed]$ zip  google.zip google_maps_api.doc //first compress or report the wrong     adding: google_maps_ Api.doc (deflated 12%)   [[email protected] awksed]$ zip -s 4m  google.zip --out ziptest   //Sub-roll    copying: google_maps_api.doc   [[email protected] awksed]$ zip ziptest -s 0 --out google_ bak.zip  //This is a problem with the roll   copying: google_maps_api.doc  [[email protected]  awksed]$ cat ziptest.z* > google_bak.zip //using cat to roll   [[email  protected] awksed]$ unzip google_bak.zip  //Decompression 

It is no problem to use zip to divide the volume, but there is a problem when the volume is closed, Zip-s 0--out the way, close the volume, about half the volume before the roll. , this made me very silent, and decompression, prompted me to enter the password, in the second no language, had to have a cat to merge, fortunately, after the merger, decompression without any problems.

Three, using split to split the volume, cat to merge the sub-volume

I spent a long time to study the parameters of tar, studied for a long time, or did not find the parameters can be divided, English or not pass ah, alas. But we can split the volume with split.

[Email protected] awksed]$ tar czvf google.tar.gz google_maps_api.doc google_maps_api.doc [[email protected] awksed]$ s Plit-d-B 4m google.tar.gz [[email protected] awksed]$ cat x* > google_bak.tar.gz [[email protected] awksed]$ tar ZX VF google_bak.tar.gz Google_maps_api.doc


Linux Sub-volume compression, combined decompression of 3 ways

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.