【Linux】快速创建文件的命令方法

[root@centos7 dir1]# ll
total 0
-rw-r--r-- 1 root root 0 Aug 15 02:39 file1
-rw-r--r-- 1 root root 0 Aug 15 02:39 file10
-rw-r--r-- 1 root root 0 Aug 15 02:39 file2
-rw-r--r-- 1 root root 0 Aug 15 02:39 file3
-rw-r--r-- 1 root root 0 Aug 15 02:39 file4
-rw-r--r-- 1 root root 0 Aug 15 02:39 file5
-rw-r--r-- 1 root root 0 Aug 15 02:39 file6
-rw-r--r-- 1 root root 0 Aug 15 02:39 file7
-rw-r--r-- 1 root root 0 Aug 15 02:39 file8
-rw-r--r-- 1 root root 0 Aug 15 02:39 file9

如果想创建file01-file10的话,可以这么创建
touch dir1/file{01..10};
[root@centos7 dir1]# ll
total 0
-rw-r--r-- 1 root root 0 Aug 15 02:41 file01
-rw-r--r-- 1 root root 0 Aug 15 02:41 file02
-rw-r--r-- 1 root root 0 Aug 15 02:41 file03
-rw-r--r-- 1 root root 0 Aug 15 02:41 file04
-rw-r--r-- 1 root root 0 Aug 15 02:41 file05
-rw-r--r-- 1 root root 0 Aug 15 02:41 file06
-rw-r--r-- 1 root root 0 Aug 15 02:41 file07
-rw-r--r-- 1 root root 0 Aug 15 02:41 file08
-rw-r--r-- 1 root root 0 Aug 15 02:41 file09
-rw-r--r-- 1 root root 0 Aug 15 02:41 file10

如果先创建file001-file010的话,可以这么创建
[root@centos7 ~]# touch dir1/file{001..10};
[root@centos7 ~]# cd dir1/
[root@centos7 dir1]# ll
total 0
-rw-r--r-- 1 root root 0 Aug 15 02:42 file001
-rw-r--r-- 1 root root 0 Aug 15 02:42 file002
-rw-r--r-- 1 root root 0 Aug 15 02:42 file003
-rw-r--r-- 1 root root 0 Aug 15 02:42 file004
-rw-r--r-- 1 root root 0 Aug 15 02:42 file005
-rw-r--r-- 1 root root 0 Aug 15 02:42 file006
-rw-r--r-- 1 root root 0 Aug 15 02:42 file007
-rw-r--r-- 1 root root 0 Aug 15 02:42 file008
-rw-r--r-- 1 root root 0 Aug 15 02:42 file009
-rw-r--r-- 1 root root 0 Aug 15 02:42 file010

posted @   zclinux  阅读(136)  评论(0编辑  收藏  举报
编辑推荐:
· 从二进制到误差:逐行拆解C语言浮点运算中的4008175468544之谜
· .NET制作智能桌面机器人:结合BotSharp智能体框架开发语音交互
· 软件产品开发中常见的10个问题及处理方法
· .NET 原生驾驭 AI 新基建实战系列:向量数据库的应用与畅想
· 从问题排查到源码分析:ActiveMQ消费端频繁日志刷屏的秘密
阅读排行:
· C# 13 中的新增功能实操
· Ollama本地部署大模型总结
· 【杭电多校比赛记录】2025“钉耙编程”中国大学生算法设计春季联赛(4)
· langchain0.3教程:从0到1打造一个智能聊天机器人
· 用一种新的分类方法梳理设计模式的脉络
点击右上角即可分享
微信分享提示