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#
相关推荐
时光の尘1 分钟前
C语言菜鸟入门·关键字·float以及double的用法
运维·服务器·c语言·开发语言·stm32·单片机·c
我们的五年6 分钟前
【Linux课程学习】:进程描述---PCB(Process Control Block)
linux·运维·c++
运维老司机29 分钟前
Jenkins修改LOGO
运维·自动化·jenkins
D-海漠1 小时前
基础自动化系统的特点
运维·自动化
我言秋日胜春朝★1 小时前
【Linux】进程地址空间
linux·运维·服务器
繁依Fanyi1 小时前
简易安卓句分器实现
java·服务器·开发语言·算法·eclipse
C-cat.1 小时前
Linux|环境变量
linux·运维·服务器
yunfanleo1 小时前
docker run m3e 配置网络,自动重启,GPU等 配置渠道要点
linux·运维·docker
m51271 小时前
LinuxC语言
java·服务器·前端
运维-大白同学2 小时前
将django+vue项目发布部署到服务器
服务器·vue.js·django