5分钟带你练习RHCSA中关于创建文件和目录的相关习题

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

[root@localhost ~]# cd /
[root@localhost /]# mkdir test

在test的目录下创建三个普通文件file1 file2 file3,给file1创建一个软链接aa,给file2创建两个硬链接

[root@localhost /]# cd test
[root@localhost test]# touch file1 file2 file3
[root@localhost test]# ll
total 0
-rw-r--r--. 1 root root 0 Oct 29 21:17 file1
-rw-r--r--. 1 root root 0 Oct 29 21:17 file2
-rw-r--r--. 1 root root 0 Oct 29 21:17 file3
[root@localhost test]# ln -s file1 aa
[root@localhost test]# ln file2 bb 
[root@localhost test]# ln file2 cc
[root@localhost test]# ll
total 0
lrwxrwxrwx. 1 root root 5 Oct 29 21:18 aa -> file1
-rw-r--r--. 3 root root 0 Oct 29 21:17 bb
-rw-r--r--. 3 root root 0 Oct 29 21:17 cc
-rw-r--r--. 1 root root 0 Oct 29 21:17 file1
-rw-r--r--. 3 root root 0 Oct 29 21:17 file2
-rw-r--r--. 1 root root 0 Oct 29 21:17 file3

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

[root@localhost test]# mkdir ceshi
[root@localhost test]# cd ceshi
[root@localhost ceshi]# touch a{1..8} b{1..8} ac{1..10} ad{1..8}
[root@localhost ceshi]# ll
total 0
-rw-r--r--. 1 root root 0 Oct 29 21:36 a1
-rw-r--r--. 1 root root 0 Oct 29 21:36 a2
-rw-r--r--. 1 root root 0 Oct 29 21:36 a3
-rw-r--r--. 1 root root 0 Oct 29 21:36 a4
-rw-r--r--. 1 root root 0 Oct 29 21:36 a5
-rw-r--r--. 1 root root 0 Oct 29 21:36 a6
-rw-r--r--. 1 root root 0 Oct 29 21:36 a7
-rw-r--r--. 1 root root 0 Oct 29 21:36 a8
-rw-r--r--. 1 root root 0 Oct 29 21:36 ac1
-rw-r--r--. 1 root root 0 Oct 29 21:36 ac10
-rw-r--r--. 1 root root 0 Oct 29 21:36 ac2
-rw-r--r--. 1 root root 0 Oct 29 21:36 ac3
-rw-r--r--. 1 root root 0 Oct 29 21:36 ac4
-rw-r--r--. 1 root root 0 Oct 29 21:36 ac5
-rw-r--r--. 1 root root 0 Oct 29 21:36 ac6
-rw-r--r--. 1 root root 0 Oct 29 21:36 ac7
-rw-r--r--. 1 root root 0 Oct 29 21:36 ac8
-rw-r--r--. 1 root root 0 Oct 29 21:36 ac9
-rw-r--r--. 1 root root 0 Oct 29 21:36 ad1
-rw-r--r--. 1 root root 0 Oct 29 21:36 ad2
-rw-r--r--. 1 root root 0 Oct 29 21:36 ad3
-rw-r--r--. 1 root root 0 Oct 29 21:36 ad4
-rw-r--r--. 1 root root 0 Oct 29 21:36 ad5
-rw-r--r--. 1 root root 0 Oct 29 21:36 ad6
-rw-r--r--. 1 root root 0 Oct 29 21:36 ad7
-rw-r--r--. 1 root root 0 Oct 29 21:36 ad8
-rw-r--r--. 1 root root 0 Oct 29 21:36 b1
-rw-r--r--. 1 root root 0 Oct 29 21:36 b2
-rw-r--r--. 1 root root 0 Oct 29 21:36 b3
-rw-r--r--. 1 root root 0 Oct 29 21:36 b4
-rw-r--r--. 1 root root 0 Oct 29 21:36 b5
-rw-r--r--. 1 root root 0 Oct 29 21:36 b6
-rw-r--r--. 1 root root 0 Oct 29 21:36 b7
-rw-r--r--. 1 root root 0 Oct 29 21:36 b8

在test目录下创建一个kaoshi的目录,在该目录下创建1-100个文件

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

在test目录下创建一个qimo的目录,在该目录下创建AA-EE的级联目录

[root@localhost test]# mkdir qimo
[root@localhost test]# cd qimo
[root@localhost qimo]# mkdir -p AA/BB BB/CC CC/DD DD/EE
[root@localhost qimo]# ll AA
total 0
drwxr-xr-x. 3 root root 16 Oct 29 21:53 BB
[root@localhost qimo]# ll BB
total 0
drwxr-xr-x. 2 root root 6 Oct 29 22:18 CC
[root@localhost qimo]# ll CC
total 0
drwxr-xr-x. 2 root root 6 Oct 29 22:18 DD
[root@localhost qimo]# ll DD
total 0
drwxr-xr-x. 2 root root 6 Oct 29 22:20 EE

打印出ceshi、qimo、kaoshi的路径

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值