Linux Command-Line – Best Way to Join Files After Splitting

command linefilesisolinuxsplit

If I have a large file and need to split it into 100 megabyte chunks I will do

split -b 100m myImage.iso

That usually give me something like

xaa
xab
xac
xad

And to get them back together I have been using

cat x* > myImage.iso

Seems like there should be a more efficient way than reading through each line of code in a group of files with cat and redirecting the output to a new file. Like a way of just opening two files, removing the EOF marker from the first one, and connecting them – without having to go through all the contents.

Windows/DOS has a copy command for binary files. The help mentions that this command was designed to able able to combine multiple files. It works with this syntax: (/b is for binary mode)

copy /b file1 + file2 + file3 outputfile

Is there something similar or a better way to join large files on Linux than cat?

Update

It seems that cat is in fact the right way and best way to join files. Glad to know i was using the right command all along 🙂 Thanks everyone for your feedback.

Best Answer

That's just what cat was made for. Since it is one of the oldest GNU tools, I think it's very unlikely that any other tool does that faster/better. And it's not piping - it's only redirecting output.

Related Question