制作/释放.zip包文件

  1. 制作/释放.zip包文件
     问题
    1)制作.zip包
     创建一个压缩包lnxtest.zip,/root目录下以install开头的文件
     压缩/boot与/etc目录,压缩名:bebak.zip
    2)解压.zip包
     将lnxtest.zip其解压到/tmp下
     将bebak.zip其解压到/tmp下
     方案
    zip压缩工具优点是可跨平台。
    在使用时,它的命令格式需注意:
    zip 压缩后文件名 源文件绝对路径
    压缩式常用选项为“-r”,压缩目录时需加上,代表递归压缩。
    解压时命令为unzip,常用选项为“-d”可以指定解压位置。
     步骤
    实现此案例需要按照如下步骤进行。
    步骤一:制作.zip包
    创建一个压缩包lnxtest.zip,/root目录下以install开头的文件,命令操作如下所示:
    [root@localhost ~]# cd /opt/
    [root@localhost opt]# rm -rf *
    [root@localhost opt]# zip lnxtest.zip /root/install*
    adding: root/install.log (deflated 75%)
    adding: root/install.log.syslog (deflated 86%)
    [root@localhost opt]# ls
    lnxtest.zip
    [root@localhost opt]#
    压缩/boot与/etc目录,压缩名:bebak.zip,命令操作如下所示:
    [root@localhost opt]# zip -r bebak.zip /boot/ /etc/
    [root@localhost opt]# ls
    bebak.zip lnxtest.zip
    [root@localhost opt]#
    步骤二:解压.zip包
    将lnxtest.zip其解压到/tmp下,命令操作如下所示:
    [root@localhost opt]# unzip /opt/lnxtest.zip -d /tmp/
    Archive: /opt/lnxtest.zip
    inflating: /tmp/root/install.log
    inflating: /tmp/root/install.log.syslog
    [root@localhost opt]#
    将bebak.zip其解压到/tmp下,命令操作如下所示:
    [root@localhost opt]# unzip /opt/bebak.zip -d /tmp/

猜你喜欢

转载自blog.csdn.net/weixin_45173557/article/details/91410880