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

[email protected]# cat filename.tar.gz.splitaa > filename.tar.gz
[email protected]# cat filename.tar.gz.splitab >> filename.tar.gz
[email protected]# cat filename.tar.gz.splitac >> filename.tar.gz
[email protected]# cat filename.tar.gz.splitad >> filename.tar.gz

To merge files at the same time

[email protected]# 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:

[email protected]# 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

[email protected]# digest -a md5 filename.tar.gz

Using chksum

[email protected]# cksum filename.tar.gz
1904556195      11875601        filename.tar.gz