Linux基础命令练习
1、 在home下创建一个以自己名字首字母开始的文件夹
root@ubuntu:/home# mkdir Gsang
root@ubuntu:/home# ls
Gsang ubuntu
# 要切换到root
2、进入此文件夹
ubuntu@ubuntu:/home$ cd Gsang/
ubuntu@ubuntu:/home/Gsang$
3、在该文件夹下直接创建 AAA/BBB 文件夹
root@ubuntu:/home/Gsang# mkdir -p AAA/BBB
root@ubuntu:/home/Gsang# ls
AAA
# -p 选项递归创建目录
4、继续在创建CCC DDD文件夹
root@ubuntu:/home/Gsang# mkdir CCC DDD
root@ubuntu:/home/Gsang# ls
AAA CCC DDD
5、进入CCC文件夹 在此文件夹中创建3个文件 1.txt 2.txt 3.txt
root@ubuntu:/home/Gsang# cd CCC
root@ubuntu:/home/Gsang/CCC# ls
root@ubuntu:/home/Gsang/CCC# touch 1.txt 2.txt 3.txt
root@ubuntu:/home/Gsang/CCC# ls
1.txt 2.txt 3.txt
6、用vim编辑器修改1.txt 内容为hello world 修改2.txt 内容为nihao 修改3.txt内容为111111
root@ubuntu:/home/Gsang/CCC# vim 1.txt
root@ubuntu:/home/Gsang/CCC# vim 2.txt
root@ubuntu:/home/Gsang/CCC# vim 3.txt
7、将三个文件拷贝到 AAA/BBB文件夹下
root@ubuntu:/home/Gsang/CCC# cp 1.txt /home/Gsang/AAA/BBB/
root@ubuntu:/home/Gsang/CCC# cp 2.txt /home/Gsang/AAA/BBB/
root@ubuntu:/home/Gsang/CCC# cp 3.txt /home/Gsang/AAA/BBB/
8、回到AAA文件夹下,创建文件4.txt 5.txt 修改内容分别为shaoxing和yuanpei
root@ubuntu:/home/Gsang/AAA# touch 4.txt
root@ubuntu:/home/Gsang/AAA# touch 5.txt
root@ubuntu:/home/Gsang/AAA# vim 4.txt
root@ubuntu:/home/Gsang/AAA