Linux快速生成指定大小文件

使用dd命令

[root@centos7-18 ~]# dd if=/dev/zero of=test bs=1M count=2
2+0 records in
2+0 records out
2097152 bytes (2.1 MB) copied, 0.0075806 s, 277 MB/s
[root@centos7-18 ~]# ll -h test
-rw-r--r--. 1 root root 2.0M Jul 12 18:00 test

在这里插入图片描述

使用head命令

[root@centos7-18 ~]# head -c 1000000 /dev/zero > test
[root@centos7-18 ~]# ll test
-rw-r--r--. 1 root root 1000000 Jul 12 17:58 test
[root@centos7-18 ~]# ll -h test
-rw-r--r--. 1 root root 977K Jul 12 17:58 test

在这里插入图片描述

posted @   岳麓丹枫  阅读(504)  评论(0编辑  收藏  举报
编辑推荐:
· Java 中堆内存和栈内存上的数据分布和特点
· 开发中对象命名的一点思考
· .NET Core内存结构体系(Windows环境)底层原理浅谈
· C# 深度学习:对抗生成网络(GAN)训练头像生成模型
· .NET 适配 HarmonyOS 进展
阅读排行:
· 本地部署 DeepSeek:小白也能轻松搞定!
· 如何给本地部署的DeepSeek投喂数据,让他更懂你
· 从 Windows Forms 到微服务的经验教训
· 李飞飞的50美金比肩DeepSeek把CEO忽悠瘸了,倒霉的却是程序员
· 超详细,DeepSeek 接入PyCharm实现AI编程!(支持本地部署DeepSeek及官方Dee
点击右上角即可分享
微信分享提示