1.软连接
1.1 创建语法step 1.创建测试文件及文件夹
[root@server6 ~]# mkdir test_chk [root@server6 ~]# touch test_chk/test.txt [root@server6 ~]# echo "hello spark" > test_chk/test.txt [root@server6 ~]# cat test_chk/test.txt hello spark [root@server6 ~]# ll 总用量 84 -rw-------. 1 root root 1257 6月 16 01:17 anaconda-ks.cfg drwxr-xr-x. 25 root root 4096 11月 1 10:28 azkabanJob -rw-r--r--. 1 root root 67322 11月 4 10:24 azkabanJob.zip drwxr-xr-x. 4 root root 37 7月 13 11:01 hadoop_temp -rw-r--r--. 1 root root 54 7月 4 14:11 HelloLinux.txt drwxr-xr-x. 2 root root 22 11月 4 10:41 test_chk -rw-r--r--. 1 root root 67 10月 8 15:52 zookeeper.out [root@server6 ~]# ln -s test_chk/ test_chk_ln [root@server6 ~]# ll 总用量 84 -rw-------. 1 root root 1257 6月 16 01:17 anaconda-ks.cfg drwxr-xr-x. 25 root root 4096 11月 1 10:28 azkabanJob -rw-r--r--. 1 root root 67322 11月 4 10:24 azkabanJob.zip drwxr-xr-x. 4 root root 37 7月 13 11:01 hadoop_temp -rw-r--r--. 1 root root 54 7月 4 14:11 HelloLinux.txt drwxr-xr-x. 2 root root 22 11月 4 10:41 test_chk lrwxrwxrwx. 1 root root 9 11月 4 10:42 test_chk_ln -> test_chk/ -rw-r--r--. 1 root root 67 10月 8 15:52 zookeeper.out [root@server6 ~]# cd test_chk_ln/ [root@server6 test_chk_ln]# ll 总用量 4 -rw-r--r--. 1 root root 12 11月 4 10:41 test.txt [root@server6 test_chk_ln]# cat test.txt hello spark [root@server6 test_chk_ln]# ll 总用量 4 -rw-r--r--. 1 root root 12 11月 4 10:41 test.txt [root@server6 test_chk_ln]# cat test.txt hello spark2.2 命令示例解释
[root@server6 test_chk_ln]# cd .. [root@server6 ~]# ll 总用量 84 -rw-------. 1 root root 1257 6月 16 01:17 anaconda-ks.cfg drwxr-xr-x. 25 root root 4096 11月 1 10:28 azkabanJob -rw-r--r--. 1 root root 67322 11月 4 10:24 azkabanJob.zip drwxr-xr-x. 4 root root 37 7月 13 11:01 hadoop_temp -rw-r--r--. 1 root root 54 7月 4 14:11 HelloLinux.txt drwxr-xr-x. 2 root root 22 11月 4 10:41 test_chk lrwxrwxrwx. 1 root root 9 11月 4 10:42 test_chk_ln -> test_chk/ -rw-r--r--. 1 root root 67 10月 8 15:52 zookeeper.out [root@server6 ~]# rm -rf ./test_chk_ln/ [root@server6 ~]# ll 总用量 84 -rw-------. 1 root root 1257 6月 16 01:17 anaconda-ks.cfg drwxr-xr-x. 25 root root 4096 11月 1 10:28 azkabanJob -rw-r--r--. 1 root root 67322 11月 4 10:24 azkabanJob.zip drwxr-xr-x. 4 root root 37 7月 13 11:01 hadoop_temp -rw-r--r--. 1 root root 54 7月 4 14:11 HelloLinux.txt drwxr-xr-x. 2 root root 6 11月 4 10:42 test_chk lrwxrwxrwx. 1 root root 9 11月 4 10:42 test_chk_ln -> test_chk/ -rw-r--r--. 1 root root 67 10月 8 15:52 zookeeper.out [root@server6 ~]# cd test_chk [root@server6 test_chk]# ll 总用量 0 [root@server6 test_chk]# ll 总用量 0可以发现该文件夹下的内容都被删了。。。
[root@server6 ~]# rm -rf ./test_chk_ln [root@server6 ~]# ll 总用量 84 -rw-------. 1 root root 1257 6月 16 01:17 anaconda-ks.cfg drwxr-xr-x. 25 root root 4096 11月 1 10:28 azkabanJob -rw-r--r--. 1 root root 67322 11月 4 10:24 azkabanJob.zip drwxr-xr-x. 4 root root 37 7月 13 11:01 hadoop_temp -rw-r--r--. 1 root root 54 7月 4 14:11 HelloLinux.txt drwxr-xr-x. 2 root root 22 11月 4 10:44 test_chk -rw-r--r--. 1 root root 67 10月 8 15:52 zookeeper.out [root@server6 ~]# cd test_chk/ [root@server6 test_chk]# ll 总用量 4 -rw-r--r--. 1 root root 12 11月 4 10:44 test.txt