【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

猜你喜欢

转载自blog.csdn.net/imliuqun123/article/details/81703920
今日推荐