Take the 2-minute tour ×

Asuming I have two files, one large file and one small file, I want to write the smaller file to the large file without overwriting the remaining part of the larger file.

Both are binary files, and the large file can become very large, so I want to avoid copying the whole file, as that will take some time. Is there any standard Linux console utility to do this, or do I need to write it myself?

share|improve this question
maybe this helps you: stackoverflow.com/questions/54365/… –  hasgarion Feb 24 '12 at 12:30
add comment

2 Answers

up vote 9 down vote accepted

This will overwrite the beginning of large-file with the contents of small-file:

dd if=small-file of=large-file conv=notrunc
share|improve this answer
add comment

I don't quite understand what you mean, but you can use cat:

cat smallfile >> largefile

This will append smallfile to largefile.

share|improve this answer
smallfile needs to be at the beginning of largefile, not at the end. –  Wimmel Mar 1 '11 at 10:48
add comment

Your Answer


