Linux批量创建多个文件

Linux批量创建多个文件

1、批量创建文件

bash 复制代码
root@DESKTOP-OV4EGIC:~/test# touch {1..100}.txt
root@DESKTOP-OV4EGIC:~/test# ls
1.txt    15.txt  21.txt  28.txt  34.txt  40.txt  47.txt  53.txt  6.txt   66.txt  72.txt  79.txt  85.txt  91.txt  98.txt
10.txt   16.txt  22.txt  29.txt  35.txt  41.txt  48.txt  54.txt  60.txt  67.txt  73.txt  8.txt   86.txt  92.txt  99.txt
100.txt  17.txt  23.txt  3.txt   36.txt  42.txt  49.txt  55.txt  61.txt  68.txt  74.txt  80.txt  87.txt  93.txt
11.txt   18.txt  24.txt  30.txt  37.txt  43.txt  5.txt   56.txt  62.txt  69.txt  75.txt  81.txt  88.txt  94.txt
12.txt   19.txt  25.txt  31.txt  38.txt  44.txt  50.txt  57.txt  63.txt  7.txt   76.txt  82.txt  89.txt  95.txt
13.txt   2.txt   26.txt  32.txt  39.txt  45.txt  51.txt  58.txt  64.txt  70.txt  77.txt  83.txt  9.txt   96.txt
14.txt   20.txt  27.txt  33.txt  4.txt   46.txt  52.txt  59.txt  65.txt  71.txt  78.txt  84.txt  90.txt  97.txt

2、批量创建目录

bash 复制代码
root@DESKTOP-OV4EGIC:~/test# mkdir  {1..100}.txt
root@DESKTOP-OV4EGIC:~/test# ls
1.txt    15.txt  21.txt  28.txt  34.txt  40.txt  47.txt  53.txt  6.txt   66.txt  72.txt  79.txt  85.txt  91.txt  98.txt
10.txt   16.txt  22.txt  29.txt  35.txt  41.txt  48.txt  54.txt  60.txt  67.txt  73.txt  8.txt   86.txt  92.txt  99.txt
100.txt  17.txt  23.txt  3.txt   36.txt  42.txt  49.txt  55.txt  61.txt  68.txt  74.txt  80.txt  87.txt  93.txt
11.txt   18.txt  24.txt  30.txt  37.txt  43.txt  5.txt   56.txt  62.txt  69.txt  75.txt  81.txt  88.txt  94.txt
12.txt   19.txt  25.txt  31.txt  38.txt  44.txt  50.txt  57.txt  63.txt  7.txt   76.txt  82.txt  89.txt  95.txt
13.txt   2.txt   26.txt  32.txt  39.txt  45.txt  51.txt  58.txt  64.txt  70.txt  77.txt  83.txt  9.txt   96.txt
14.txt   20.txt  27.txt  33.txt  4.txt   46.txt  52.txt  59.txt  65.txt  71.txt  78.txt  84.txt  90.txt  97.txt

3、文件批量重命名

替换文件名.bak为空

bash 复制代码
root@DESKTOP-OV4EGIC:~/test# touch {1..10}.txt.bak
root@DESKTOP-OV4EGIC:~/test# ls
1.txt.bak  10.txt.bak  2.txt.bak  3.txt.bak  4.txt.bak  5.txt.bak  6.txt.bak  7.txt.bak  8.txt.bak  9.txt.bak
root@DESKTOP-OV4EGIC:~/test# rename s/\.bak// *
root@DESKTOP-OV4EGIC:~/test# ls
1.txt  10.txt  2.txt  3.txt  4.txt  5.txt  6.txt  7.txt  8.txt  9.txt
root@DESKTOP-OV4EGIC:~/test#
相关推荐
TensorFlowGAN1 小时前
rhcsa、ce复习(每日编辑,复习完为止)
linux·es
Drscq2 小时前
How to migrate a CentOS 8 to Rocky Linux 8.10
linux·运维·centos
修心光2 小时前
CentOS配置iptables规则并使其永久生效
linux·运维·centos
加载中loading...2 小时前
Linux线程安全(二)条件变量实现线程同步
linux·运维·服务器·c语言·1024程序员节
安科瑞刘鸿鹏2 小时前
校园建筑用电安全监测装置 电气火灾监测预防设备功能介绍
运维·服务器·网络·嵌入式硬件·安全·能源
课堂随想2 小时前
【libGL error】Autodl云服务器配置ACT的conda虚拟环境生成训练数据时,遇到了libGL相关错误,涉及swrast_dri.so
运维·服务器·conda
画江湖Test3 小时前
SDK如何测试
服务器·sdk
well_fly5 小时前
Ubuntu特殊目录
linux·ubuntu
落落落sss5 小时前
es实现自动补全
大数据·服务器·elasticsearch·搜索引擎·全文检索
大熊程序猿5 小时前
ubuntu 安装k3s
linux·运维·ubuntu