Linux – overwrite the header of a file without copying the whole file

command linelinux

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?

Best Answer

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

dd if=small-file of=large-file conv=notrunc
Related Question