主题
cp/rm/mv练习任务
任务准备
更换安装源(可选)
shell
# 删除原有源
rm -f /etc/yum.repos.d/*.repo
# 下载阿里源
curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
# 清理YUM缓存
yum clean all
# 生成新的YUM缓存
yum makecache
# 显示已配置的YUM软件仓库及其包数量的信息
yum repolist1
2
3
4
5
6
7
8
9
10
11
12
13
14
2
3
4
5
6
7
8
9
10
11
12
13
14
安装tree
bash
yum -y install tree1
任务部署
bash
mkdir -p /home/father/son /home/father/bro
touch /home/father/son/test.txt /home/father/bro/test.txt
echo "hello world" > /home/father/son/test.txt
echo "no hello world" > /home/father/bro/test.txt1
2
3
4
2
3
4
查看home文件夹结构
使用tree /home命令如下

任务练习
在/home下创建文件夹backup
把/home/father/son目录中的test.txt文件复制到/home/backup中,并命名为test_bk.txt文件
把/home/father目录(包括所有后代文件)复制到/home/backup中,并命名为father_bk目录

在/home/backup下创建/home/father/son/test.txt的软链接并命名为son_sl.txt
在/home/backup下创建/home/father/bro/test.txt的硬链接并命名为son_hl.txt

删除/home/father/son/test.txt文件
删除/home/father/bro文件夹
考核执行结果
查看home目录树是否与下图一致

使用cat命令查看son_hl.txt和son_sl.txt的内容,显示是否如下一致
