How can I copy several binary files into one file on a Linux system?

Ahatius picture Ahatius · Apr 27, 2012 · Viewed 72.1k times · Source

I need to copy the content of a folder which contains binary files to one binary file in another directory.

In Windows I can just use:

copy file1 + file2 targetfile /B 

I couldn't find something similar for Linux (I saw an approach with cat, but I'm unsure if this really works for binary files).

Answer

geekosaur picture geekosaur · Apr 27, 2012

Unix has no distinction between text and binary files, which is why you can just cat them together:

cat file1 file2 > target_file