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#
相关推荐
橘子真甜~19 分钟前
C/C++ Linux网络编程8 - epoll + ET Reactor TCP服务器
linux·服务器·网络
万变不离其宗_825 分钟前
centos 手动安装redis
linux·redis·centos
_lst_28 分钟前
linux进程状态
linux·运维·服务器
霍格沃兹测试开发学社-小明1 小时前
AI来袭:自动化测试在智能实战中的华丽转身
运维·人工智能·python·测试工具·开源
稚辉君.MCA_P8_Java1 小时前
Gemini永久会员 归并排序(Merge Sort) 基于分治思想(Divide and Conquer)的高效排序算法
java·linux·算法·spring·排序算法
wanderist.1 小时前
Linux使用经验——离线运行python脚本
linux·网络·python
MaisieKim_1 小时前
2025年企业文档管理系统全面评测报告
运维·数据库
biter00882 小时前
Ubuntu 22.04 有线网络时好时坏?最终解决方案
linux·网络·ubuntu
德育处主任2 小时前
『NAS』轻松获取群晖自带的壁纸
服务器·docker
zzzsde2 小时前
【Linux】基础开发工具(3):编译器
linux·运维·服务器