bash 如何在 Linux 系统上将多个二进制文件复制到一个文件中?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10347278/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 21:59:45  来源:igfitidea点击:

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

bashbinarycopy

提问by Ahatius

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:

在 Windows 中,我可以使用:

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

我在 Linux 上找不到类似的东西(我看到了一种方法cat,但我不确定这是否真的适用于二进制文件)。

回答by geekosaur

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

Unix 没有区分文本文件和二进制文件,这就是为什么您可以将cat它们放在一起:

cat file1 file2 > target_file

回答by choroba

catis 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是一个非常有用的实用程序,它将一个或多个文件的内容输出到标准输出。可以使用 shell 功能将其重定向到文件中。它适用于二进制或 ascii 文件。在一些不使用链接的编程语言中,cat 用于将二进制文件合并为单个可执行文件。

cat file1 file2 > target_file