Merge Files in UNIX / Linux Systems

In response from our last post regarding splitting of large files, we will now discuss on merging these files for us to be able to use it again. We will also be discussing on checking the md5 hash and chksum.

To merge small amount of split files

root@solaris# cat filename.tar.gz.splitaa > filename.tar.gz
root@solaris# cat filename.tar.gz.splitab >> filename.tar.gz
root@solaris# cat filename.tar.gz.splitac >> filename.tar.gz
root@solaris# cat filename.tar.gz.splitad >> filename.tar.gz

To merge files at the same time

root@solaris# cat filename.tar.gz.split* > filename.tar.gz

If in case your splitted files are too many to be handled by the shell you could your this work around:

root@solaris# ls filename.tar.gz.split* | xargs cat > filename.tar.gz

For us to be able to verify the integrity of our files here are the two ways to check

Using digest to get the md5 hash

root@solaris# digest -a md5 filename.tar.gz

Using chksum

roo@solaris# cksum filename.tar.gz
1904556195      11875601        filename.tar.gz