windows10/liunx创建空大文件

1.windows10创建空大文件
打开cmd命令,进入需要创建文件的目录,使用以下命令创建

fsutil file createnew test001.txt 1073741824

最后的数字代表文件的字节数

创建一个100M的文件,那么文件大小应该是1024 X 1024 X 100

创建一个1G大小的文件,那么就是1024 X 1024 X 1024 X 1

 

2.liunx创建空大文件

(1)fallocate 命令生成方法

fallocate -l 10000000 test.log

(2)truncate 命令生成方法:

truncate -s 25M test2.log

(3)dd 命令生成方法:

dd if=/dev/urandom of=test3.log bs=10MB count=1
dd if=/dev/zero of=test4.log bs=10MB count=1

(4)head 命令生成方法:

head -c 10MB /dev/urandon > test.log
head -c 10M /dev/zero > test.log

查看创建的结果:

 

 

 

posted @ 2022-06-17 23:11  Mrwhite86  阅读(574)  评论(0编辑  收藏  举报