超详细!教你在Linux中创建文件及目录

今天来学习在Linux中创建文件及目录,接下来,请看操作 

1、在根下创建一个叫做test的目录

[root@localhost ~]# cd /               //切换到根下
[root@localhost /]# mkdir test         //创建test目录

查看一下

2、在test的目录下创建三个普通文件file1 file2 file3 

[root@localhost test]# touch file1 file2 file3    //用touch命令创建

查看一下 

 (1)给file1创建一个软链接aa

[root@localhost test]# ln -s file1 aa   //创建软链接aa

 查看一下

(2)给file2创建两个硬链接 

[root@localhost test]# ln file2 a     //创建硬链接a
[root@localhost test]# ln file2 b     //创建硬链接b

 查看一下

3、在test目录下创建一个ceshi的目录

[root@localhost test]# mkdir ceshi

在ceshi的目录下创建a1-a8,b1-b8,ac1-ad8的文件

[root@localhost test]# cd ceshi         //记得切换到ceshi目录下
[root@localhost ceshi]# touch {a..b){1..8}
[root@localhost ceshi]# touch ac{1..8} 
[root@localhost ceshi]# touch ad{1..8} 

查看一下 

4、在test目录下创建一个kaoshi的目录

[root@localhost ~]# cd /test     //记得切换到test目录下
[root@localhost test]# mkdir kaoshi

在该目录下创建1-100个文件

[root@localhost test]# cd kaoshi         //切换到kaoshi目录下
[root@localhost kaoshi]# touch {1..100}

查看一下 

 

5、在test目录下创建一个qimo的目录

[root@localhost test]# mkdir qimo

在该目录下创建AA-EE的级联目录

[root@localhost test]# cd qimo     //切换到qimo目录下
[root@localhost qimo]# mkdir -p AA/BB/CC/DD/EE     //创建级联目录

查看一下(此处用tree命令)查看,更直观

6、打印出ceshi、qimo、kaoshi的路径

至此,创建文件及目录结束,通过上述讲解,相信屏幕前的你一定有所收获吧,后续知识,敬请期待

  • 4
    点赞
  • 27
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值