RHCSA_第五天_作业

  1. Linux中的文件类型以及符号的表示
(1)普通文件:符号是 - 
(2)目录文件:符号是 d
(3)字符设备文件:符号是c
(4)块设备文件:符号是b
(5)符号链接文件:符号是l
  1. 创建目录test
[root@PPDY ~]# mkdir test
[root@PPDY ~]# ls
anaconda-ks.cfg  original-ks.cfg  test
  1. 使用两种方式在test目录中创建文本文件text1.txt, text2.txt
    使用Vim在文件text1.txt中写入
    Welcome to my Linux.
    You are the best.
    This is my first file to create on linux.
[root@PPDY test]# vim text1.txt
			进入text1.txt后,按i a o进入输入模式,输入三行英文,
						然后按ESC,进入命令模式
						然后按 :进入末行模式,输入wq安全保存退出
[root@PPDY test]# touch text2.txt
[root@PPDY test]# ls
text1.txt  text2.txt
  1. 将test中的文件拷贝到test2目录
[root@PPDY ~]# mkdir test2
[root@PPDY ~]# ls
anaconda-ks.cfg  original-ks.cfg  test  test2
[root@PPDY ~]# cd test
[root@PPDY test]# cp text1.txt /root/test2
[root@PPDY test]# cp text2.txt /root/test2
[root@PPDY test]# cd /root/test2
[root@PPDY test2]# ls
text1.txt  text2.txt

  1. 将test2目录中的test1.txt重命名为test111.txt
[root@PPDY test2]# mv text1.txt test111.txt
[root@PPDY test2]# ls
test111.txt  text2.txt
  1. 在test2目录中新建test111.txt的软链接文件 test111_soft.txt
[root@PPDY test2]# ln -s test111.txt test111_soft.txt
  1. 在test2目录中新建test111.txt的硬链接文件 test111_hard.txt
[root@PPDY test2]# ln test111.txt test111_hard.txt
[root@PPDY test2]# ls -l
total 8
-rw-r--r--. 2 root root 84 Nov 16 08:50 test111_hard.txt
lrwxrwxrwx. 1 root root 11 Nov 16 08:57 test111_soft.txt -> test111.txt
-rw-r--r--. 2 root root 84 Nov 16 08:50 test111.txt
-rw-r--r--. 1 root root  0 Nov 16 08:51 text2.txt
  1. 删除test目录中test1.txt
[root@PPDY test]# cd /root
[root@PPDY ~]# rm -rf test/text1.txt 
[root@PPDY ~]# ls -l test/
total 0
-rw-r--r--. 1 root root 0 Nov 16 08:41 text2.txt
  1. 删除test目录
[root@PPDY ~]# rm -rf test
[root@PPDY ~]# ls -l
total 8
-rw-------. 1 root root 2817 Nov  1 04:24 anaconda-ks.cfg
-rw-------. 1 root root 2064 Nov  1 04:24 original-ks.cfg
drwxr-xr-x. 2 root root   90 Nov 16 08:57 test2
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值