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
How can I copy several binary files into one file on a Linux system?
提问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 cat
them together:
Unix 没有区分文本文件和二进制文件,这就是为什么您可以将cat
它们放在一起:
cat file1 file2 > target_file
回答by choroba
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
是一个非常有用的实用程序,它将一个或多个文件的内容输出到标准输出。可以使用 shell 功能将其重定向到文件中。它适用于二进制或 ascii 文件。在一些不使用链接的编程语言中,cat 用于将二进制文件合并为单个可执行文件。
cat file1 file2 > target_file