如何在 Linux 中创建给定大小的文件? [英] How to create a file with a given size in Linux?
本文介绍了如何在 Linux 中创建给定大小的文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
出于测试目的,我必须生成一个特定大小的文件(以测试上传限制).
For testing purposes I have to generate a file of a certain size (to test an upload limit).
Linux 上创建特定大小文件的命令是什么?
What is a command to create a file of a certain size on Linux?
推荐答案
对于小文件:
dd if=/dev/zero of=upload_test bs=file_size count=1
其中 file_size
是测试文件的大小(以字节为单位).
Where file_size
is the size of your test file in bytes.
对于大文件:
dd if=/dev/zero of=upload_test bs=1M count=size_in_megabytes
这篇关于如何在 Linux 中创建给定大小的文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文