Split large files in parts from ubuntu linux without external software

Sometimes happens to me to have a file too large to fit on a pendrive or on a fat partition (wich doesn't support files greater than 4Gb) on Ubuntu or another linux distribution.

To move it from a pc to another you need to split it in parts smaller than 4Gb, move them separately and then rebuild the original file on the targer machine. To do this on ubuntu you don't need special software, you need only a shell with basic commands,

First you need to open a shell and point to the directory where you have the file you need to split, then you need to execute the following command;

split -d -b 1000M <originalFileName> <splittedFileName>

where -d states that you want to define the part size in decimal, -b that you are defining part size in bytes and 1000M states that you want to split in 1000 megabytes files.

when the command execution ends you'll have many files with name <splittedFileName>00, <splittedFileName>01, <splittedFileName>02 etc.. now you can move these files to the target destination where you want to rejoin them.

once trasferred all the files to the target we'll need to open a terminal and point to the path where we have the files that we need to join and use the cat command to rebuild the original file as follow:

cat <splittedFileName>00 <splittedFileName>01 <splittedFileName>02  >  <originalFileName>

You need here to specify the original file name with the original extension because with split the file extension is lost.

Obviously you need to specify all the parts in the right order to rebuild correctly the original file.

 

The commands used in this example are all basic commands so you can find them in almost every linux distribution.