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

霸气de小男生 提交于 2019-12-03 10:29:17

问题


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).


回答1:


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

cat file1 file2 > target_file



回答2:


cat is a very useful utility that will output the content of one or more files to standard output. That can be redirected with shell-funcionality into a file. It will work with binary or ascii files. In some programming languages that do not use linking, cat is used to merge binary files into a single executable file.

cat file1 file2 > target_file


来源:https://stackoverflow.com/questions/10347278/how-can-i-copy-several-binary-files-into-one-file-on-a-linux-system

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!