I want to combine two or more files in Linux, so I am using the following command:
cat small_file LARGE_File LARGER_FILE > SUM_OF_FILES
However this runs very slow.
Does anyone know a Linux tool that combines the files in the fastest time?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
You could try a variation on the dd command, such as:
dd if=small_file bs=4k of=SUM_OF_FILES dd if=LARGE_FILE bs=4k of=SUM_OF_FILES oflag=append dd if=LARGER_FILE bs=4k of=SUM_OF_FILES oflag=append
I've found mmv (Mass Move and rename - Move, copy, append or link Multiple files using wildcard patterns.) from this useful bash reference. So you could do:
cp small_file SUM_OF_FILES mmv -a LARGE_File SUM_OF_FILES mmv -a LARGER_FILE SUM_OF_FILES
(note: mmv isn't installed by default, use
sudo apt-get install mmv)