Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/file/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在Linux中使用模式创建具有给定大小的大文件_Linux_File_Large Files - Fatal编程技术网

在Linux中使用模式创建具有给定大小的大文件

在Linux中使用模式创建具有给定大小的大文件,linux,file,large-files,Linux,File,Large Files,在Linux中,如何使用给定的文本或十六进制模式(如DeadBeefReadBeefDeadBeef…)创建一个大文件 我知道dd可以用来创建大文件,但它不能写入所需的文本或十六进制模式 dd if=/dev/urandom of=/tmp/bigfile bs=blocksize count=size 或 如果您的目的是实现数据加扰而非随机 shuf folder/* | dd of=target.txt bs=1K count=2048 要获得2MB的示例文件,您可以缩短该文件,或者使

在Linux中,如何使用给定的文本或十六进制模式(如DeadBeefReadBeefDeadBeef…)创建一个大文件

我知道dd可以用来创建大文件,但它不能写入所需的文本或十六进制模式

dd if=/dev/urandom of=/tmp/bigfile bs=blocksize count=size


如果您的目的是实现数据加扰而非随机

shuf folder/* | dd of=target.txt bs=1K count=2048
要获得2MB的示例文件,您可以缩短该文件,或者使用不同的计数数字再次调用上面的命令

folder/* will contain files with your patterns
或者,您也可以将十六进制值存储在一个单独的文件中,并使用
shuf
根据您的需要对其进行洗牌并填充

shuf -n 100 source.txt | dd of=target.txt bs=1K count=2048
或者,您可以将其作为

dd if=source.txt of=target.txt bs=1K count=2048

是死牛肉| tr-d\\n | dd…
为真;执行printf“\xDE\xAD\xBE\xEF”;完成| dd of=/tmp/file bs=1c count=32
很抱歉,这不起作用。源文件有4个字节(DEADBEEF)
dd if=source.txt of=target.txt bs=1K count=2048
while true ; do printf "DEADBEEF"; done | dd of=/tmp/bigfile bs=blocksize count=size iflag=fullblock