linux编程基础黑马要点总结,黑马《linux基础编程》学习笔记(从6到10)

六. 绝对路径和相对路径

5724c48ffe3249943236b4b003f21e80.png

657c4c11b1dba10594adb2df27e2d322.png

七. ls和常用参数

a899062af55271a1de89566a9caa2cba.png

2e40bc71ca35ec0f98ffa48de2609d50.png

505b62968ceea3f20f5aa841cc211b1e.png

八. cd和pwd命令

446562b4138da990e549b9c7ac1ecf8a.png

九. rm命令

872f2d073373dfcd9860386d1d9e9900.png

十. cp命令

076daa784f1202a544c59a2d0a741f41.png

实验操作

//建立空的文件夹test

[root@VM_0_15_centos home]# mkdir test

[root@VM_0_15_centos home]# cd test

[root@VM_0_15_centos test]# ls

//文件夹中建立hello.txt这个文件

[root@VM_0_15_centos test]# touch hello.txt

[root@VM_0_15_centos test]# ls

hello.txt

//情况一: cp 要拷贝的文件(file) file1(不存在)

//结果:创建file1,并将file的内容拷贝到file1

[root@VM_0_15_centos test]# cp hello.txt target

[root@VM_0_15_centos test]# ls

hello.txt target

//情况二: cp 要拷贝的文件(file) file1(存在)

//结果:file的内容覆盖file1的内容

[root@VM_0_15_centos test]# cp hello.txt target

[root@VM_0_15_centos test]# vi target

//情况三: cp file dir(存在)

//结果:拷贝file到dir目录

[root@VM_0_15_centos test]# mkdir son

[root@VM_0_15_centos test]# ls

hello.txt son target

[root@VM_0_15_centos test]# cp hello.txt son

[root@VM_0_15_centos test]# ls

hello.txt son target

[root@VM_0_15_centos test]# cd son

[root@VM_0_15_centos son]# ls

hello.txt

//情况四: cp dir(存在)dir1(存在)

//结果:将dir目录拷贝到dir1,包括dir目录

[root@VM_0_15_centos son]# cd ..

[root@VM_0_15_centos test]# ls

hello.txt son target

[root@VM_0_15_centos test]# mkdir son2

[root@VM_0_15_centos test]# cp son son2 -r

[root@VM_0_15_centos test]# ls

hello.txt son son2 target

[root@VM_0_15_centos test]# cd son2

[root@VM_0_15_centos son2]# ls

son

[root@VM_0_15_centos son2]# cd ..

[root@VM_0_15_centos test]# tree son2

son2

`-- son

`-- hello.txt

//情况五: cp dir(存在)dir1(不存在)

//结果:创建dir1,将dir目录拷贝到dir1,不包括dir目录

1 directory, 1 file

[root@VM_0_15_centos test]# ls

hello.txt son son2 target

[root@VM_0_15_centos test]# cp son a

cp: omitting directory ‘son’

[root@VM_0_15_centos test]# cp son a -r

[root@VM_0_15_centos test]# ls

a hello.txt son son2 target

[root@VM_0_15_centos test]# tree a

a

`-- hello.txt

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值