⑩②. 打包或解压tar 重点
- ①. 打包为 tar 格式的文件:
[root@localhost home]# tar -cvf hello.tar hello hello-hard hello-soft hello hello-hard hello-soft [root@localhost home]# ls hello hello-hard hello-soft hello.tar test test-soft [root@localhost home]#
②. 压缩为 tar.gz 格式的文件:
[root@localhost home]# tar -zcvf test.tar.gz test test-soft test/ test-soft [root@localhost home]# ls hello hello-hard hello-soft hello.tar test test-soft test.tar.gz [root@localhost home]#
③. 解打包 tar 格式的文件:
[root@localhost home]# tar -xvf hello.tar hello hello-hard hello-soft [root@localhost home]# ls hello hello-hard hello-soft hello.tar test.tar.gz [root@localhost home]#
④. 解压缩 tar.gz 格式的文件:
[root@localhost home]# tar -zxvf test.tar.gz test/ test-soft [root@localhost home]# ls hello hello-hard hello-soft hello.tar test test-soft test.tar.gz [root@localhost home]#
⑩③. 软链接 (快捷方式)
- ①. 也成为符号链接,类似于windows里的快捷方式,有自己的数据块,主要存放了链接其他文件的路径
- ②. 命令 ln –s 原文件或目录名 软链接名
- ③. 查询:通过 ls -l 就可以查看,列表属性第1位是l,尾部会有位置指向
[root@izuf6ge69gbpc9ab8f8dvfz /]# ln -s /opt myOpt [root@izuf6ge69gbpc9ab8f8dvfz /]# ll total 68 lrwxrwxrwx. 1 root root 7 Aug 18 2017 bin -> usr/bin dr-xr-xr-x. 4 root root 4096 Sep 12 2017 boot drwxr-xr-x 19 root root 2960 Jul 22 20:30 dev drwxr-xr-x. 83 root root 12288 Jul 23 00:47 etc drwxr-xr-x. 4 root root 4096 May 30 09:54 home lrwxrwxrwx. 1 root root 7 Aug 18 2017 lib -> usr/lib lrwxrwxrwx. 1 root root 9 Aug 18 2017 lib64 -> usr/lib64 drwx------. 2 root root 16384 Aug 18 2017 lost+found drwxr-xr-x. 2 root root 4096 Nov 5 2016 media drwxr-xr-x. 2 root root 4096 Nov 5 2016 mnt lrwxrwxrwx 1 root root 4 Jul 23 10:36 myOpt -> /opt drwxr-xr-x. 2 root root 4096 Nov 5 2016 opt dr-xr-xr-x 78 root root 0 Jul 22 20:30 proc dr-xr-x---. 10 root root 4096 Jul 23 00:46 root drwxr-xr-x 21 root root 620 Jul 23 00:47 run lrwxrwxrwx. 1 root root 8 Aug 18 2017 sbin -> usr/sbin drwxr-xr-x. 2 root root 4096 Nov 5 2016 srv dr-xr-xr-x 13 root root 0 Jul 23 04:30 sys drwxrwxrwt. 10 root root 4096 Jul 23 00:47 tmp drwxr-xr-x. 14 root root 4096 Jul 22 23:38 usr drwxr-xr-x. 19 root root 4096 Jul 23 04:30 var [root@izuf6ge69gbpc9ab8f8dvfz /]# cd myOpt/ [root@izuf6ge69gbpc9ab8f8dvfz myOpt]# ll total 0 [root@izuf6ge69gbpc9ab8f8dvfz myOpt]# cd /opt total 0