Split and join files in Ubuntu with lxsplit
Posted: July 21, 2009 at 7:44 pm | Tags: install lxsplit, join files, lxsplit, split filesBelow I describe how to split a larger file into several small files. This is useful when the file you want to copy on a stick is bigger than the stick’s capacity.
The file used is this example is a 75 MB .mkv.
I will use lxsplit for splitting and joining the .mkv file. So, I need to install lxsplit:
wget http://sourceforge.net/projects/lxsplit/files/lxsplit/lxsplit-0.2.4.tar.gz/download
Decompression:
ducu@mylaptop:~/temp$ tar -xvvzf lxsplit-0.2.4.tar.gz
drwxrwxr-x ozzie/ozzie 0 2008-10-03 15:28 lxsplit-0.2.4/
-rw-rw-r– ozzie/ozzie 3200 2008-02-02 10:03 lxsplit-0.2.4/mkuoff_t.c
-rw-rw-r– ozzie/ozzie 1618 2008-05-31 11:03 lxsplit-0.2.4/Makefile
-rw-rw-r– ozzie/ozzie 2520 2008-07-02 20:15 lxsplit-0.2.4/func.c
-rw-rw-r– ozzie/ozzie 2440 2008-10-03 15:05 lxsplit-0.2.4/config.h
-rw-rw-r– ozzie/ozzie 4749 2008-02-02 10:03 lxsplit-0.2.4/merge.c
-rw-rw-r– ozzie/ozzie 1070 2008-02-02 09:45 lxsplit-0.2.4/merge.h
-rw-rw-r– ozzie/ozzie 2345 2008-10-03 15:09 lxsplit-0.2.4/README
-rw-rw-r– ozzie/ozzie 1715 2008-10-03 15:09 lxsplit-0.2.4/ChangeLog
-rw-rw-r– ozzie/ozzie 1174 2008-07-02 20:15 lxsplit-0.2.4/func.h
-rw-rw-r– ozzie/ozzie 1320 2008-10-03 15:25 lxsplit-0.2.4/lxsplit.spec
-rw-rw-r– ozzie/ozzie 1080 2008-02-02 10:03 lxsplit-0.2.4/split.h
-rw-rw-r– ozzie/ozzie 4375 2008-10-03 15:04 lxsplit-0.2.4/split.c
-rw-rw-r– ozzie/ozzie 3670 2008-10-03 15:03 lxsplit-0.2.4/main.c
-rw-rw-r– ozzie/ozzie 17990 2008-02-02 09:45 lxsplit-0.2.4/COPYING
Access the new folder and give the make command:
cd lxsplit-0.2.4/
make
Next, make install command. This is the result:
ducu@mylaptop:~/temp/lxsplit-0.2.4$ sudo make install
cp lxsplit /usr/local/bin
This is my 75MB .mkv file:
ducu@mylaptop:~/movies/Inside.Man.2006.1080p.HDDVD.x264-SZ/Sample$ ls -alh
total 75M
drwxr-xr-x 2 ducu ducu 4.0K 2009-07-21 21:28 .
drwxr-xr-x 3 ducu ducu 4.0K 2009-06-13 02:15 ..
-rw-r–r– 1 ducu ducu 75M 2009-06-13 02:47 Inside.Man.2006.1080p.HDDVD.x264-SZ-SAMPLE.mkv
I will split the 75 MB file in chunks of 20 MB.
ducu@mylaptop:~/movies/Inside.Man.2006.1080p.HDDVD.x264-SZ/Sample$ lxsplit -s Inside.Man.2006.1080p.HDDVD.x264-SZ-SAMPLE.mkv 20M
Splitting Inside.Man.2006.1080p.HDDVD.x264-SZ-SAMPLE.mkv into 4 pieces.
Inside.Man…SZ-SAMPLE.mkv.001 20971520 bytes
Inside.Man…SZ-SAMPLE.mkv.002 20971520 bytes
Inside.Man…SZ-SAMPLE.mkv.003 20971520 bytes
Inside.Man…SZ-SAMPLE.mkv.004 14767172 bytes
Done!
Now I will join the 4 resulted files:
ducu@mylaptop:~/movies/Inside.Man.2006.1080p.HDDVD.x264-SZ/Sample$ lxsplit -j Inside.Man.2006.1080p.HDDVD.x264-SZ-SAMPLE.mkv.001
Creating merged file `Inside.Man.2006.1080p.HDDVD.x264-SZ-SAMPLE.mkv’.
Complete size: 77681732 in 4 files.
Processing file `Inside.Man…SZ-SAMPLE.mkv.001′ …
Processing file `Inside.Man…SZ-SAMPLE.mkv.002′ …
Processing file `Inside.Man…SZ-SAMPLE.mkv.003′ …
Processing file `Inside.Man…SZ-SAMPLE.mkv.004′ …
Done!
If you used this tutorial or have any questions, feel free to leave a comment below. You can also rate this tutorial to let me know how I’m doing. Thanks!

























The Discussion
see what everyone is saying
Very good tutorial. Exactly what I needed.
It would be amazing if it was in English, or if there was a plugin for translation.
Thanks a lot!
@Dean
I’m glad you find this helpful. Soon the translation plugin will be avaible. Come back and check it!
Super tare, credeam ca sunt singurul care cautam asemenea informatii
.
Thank you for your help!
Hi
I got the following error while i tried ‘make’ on the lxsplit-0.2.4 folder.
I have the structure as ~/download/lxsplit-0.2.4 .
help requested.
thx
raj
@raj: Please specify the error you get.
lxsplit is in the ubuntu repositories – you can install with synaptic or apt.
Doesn’t work if you just split the files. Sure, you get 2 files of size specified – but if you view #1 – it will still show the full length and the second one will be soundless and garbled video.
Thanks for your step by step illustration!!
worked perfectly for me ….
keep up the good work…
im able to open just the first file … later ones seem corrupted
help anyone??
You you should make changes to the post subject Split and join files in Ubuntu with lxsplit | EtutsResourcesIT to something more specific for your blog post you create. I loved the the writing even sononetheless.