How to split large files on Linux


pizza

Have you ever needed to split a file into several parts? Today I made a VirtualBox Appliance which sizes 2.8 GB but I  have a 2 GB (1.8 Gb) pendrive. So, what can I do?…piece of cake, to use split and cat commands:

Split

Let’s say you want to split the file Draco.vdmk (a VirtualBox disk) into 1.5 Gb smaller parts, then just type:

split -b 1500m Draco.vmdk

Cat

In order to put thing together just use:

cat x* > Draco.vmdk

References

Share this:
  • Twitter
  • Facebook
  • Identi.ca
  • del.icio.us

Related posts:

  1. Making less read non-text files
  2. Adding subtitles to avi files
  3. Reversing order of PDF files
  4. Montando sistemas de archivos en Linux
  5. Running Windows apps on Linux

  1. Skip

    #1 by Skip on 07/06/2010 - 11:43 pm

    Nice, this is what I was looking to find out… I would like to see some output though… For instance, since I first saw some stuff on using the split command, they mentioned the way it names the output files, per your example, I’m guessing x?????

    Anyways, thanks for letting me know it works with virtual disks!

  2. Luis Gallardo

    #2 by Luis Gallardo on 08/06/2010 - 1:38 pm

    @Skip Yes, the split command creates output files with this format xaa, xab, xac, etc. But you can change the prefix. For instance,

    split -d -b 500KB BASE.PBP part

    The above command makes the following files:

    -rw-r–r– 1 lgallard lgallard 500000 Jun 8 13:34 part00
    -rw-r–r– 1 lgallard lgallard 500000 Jun 8 13:34 part01
    -rw-r–r– 1 lgallard lgallard 392801 Jun 8 13:34 part02

    Cheers!!

(will not be published)

Switch to our mobile site