1 、创建文件命令练习:
( 1 ) 在 / 目录下创建一个临时目录 test ;

( 2 )在临时目录 test 下创建五个文件,文件名分别为 passwd , group , bashrc , profile ,
sshd_config ;

( 3 )在 /test 创建 /etc/motd 的软链接,文件名为 motd.soft; 创建 /etc/motd 的硬链接为 motd.hard

2 、重定向练习:
( 1 )将系统内核版本信息,发行版本信息,写入到 /test/motd.soft 文件中

( 2 )将当前主机主机名,当前用户使用的 shell 信息追加到 /test/motd.hard 文件中

( 3 )将根目录下的文件的文件名写入 /test/file 文件中

( 4 )查看当前工作目录是否为 /test 目录,将当前工作目录的详细信息追加到 /test/file 文件中

3 、 tee 命令练习:
( 1 )将当前时间添加至 /test 目录下的 passwd , group , bashrc , profile , sshd_config 文件中

( 2 )将当前用户的用户名追加至 /test 目录下的 passwd , group , bashrc , profile , sshd_config 文件 中

4 、 vim 命令练习:
( 1 )将 /etc/passwd 文件内容读入 /test/passwd ,并修改文件里的 root 字符为 admin
vim /test/passwd 切换到末行模式 :r /etc/passwd :%s/root/admin/g

( 2 )将 /etc/group 文件内容读入 /test/group ,只保留 root 开头的行内容
vim /test/group 切换到末行模式 :r /etc/group :v/^root/d

( 3 )将 /root/.bashrc 文件内容读入 /test/bashrc ,删除 # 号开头的行内容 命令
vim /test/bashrc 切换到末行模式 :r /root/.bashrc :g/#/d

( 4 )将 /etc/ssh/sshd_config 文件内容读入 /test/sshd_config, 在该文件的第 17 行后添加一行内容
Port 22
vim /test/sshd_config :r /etc/ssh/sshd_config :set nu

( 5 )将 /test/sshd_config 文件中的第 40-50 行的 yes 改为 no
: 40,50 s/yes/no/g

( 6 )将 /test/sshd_config 文件另存为 /test/sshd.conf
:w /test/sshd.conf

( 7 )将 /test 目录下的 passwd , group , bashrc 文件中的第一行内容复制至文档最后一行
跳到首行 gg 复制 yy 跳到最后 G 粘贴p

( 8 )将 /test 目录下的 profile , sshd_config 文件中前两行内容复制至文档倒数第二行
跳到首行gg 复制从光标开始的两行2yy 跳到最后一行G 粘贴p
