zoukankan      html  css  js  c++  java
  • Linux ->> Linux下压缩和解压缩命令targzipzip

    tar命令解压tar、 gz、bz2结尾的压缩包,-C 目标文件夹,-f 文件名,区别是bz2是 tar -j 而gz是-z

    tar -zxvf VMwareTools-10.0.5-3228253.tar.gz -C /home/VMTools
    tar -jxvf VMwareTools-10.0.5-3228253.tar.bz2 -C /home/VMTools
    tar -zcvf gz_test.tar.gz ./test.txt ./test2.txt

    上面是打包多个文件

    下面是打包整个目录

    tar -zcvf gz_test.tar.gz ./*

    tar命令压缩打包文件到压缩包,打包test.txt和cmd两个文件到archive.tar,-f指定目标文件名,-c表示打包

    tar -cf archive.tar test.txt cmd.txt

    如果不解压,就只查看压缩包里的文件

    tar -tf archive.tar

    zip和unzip分别打包zip和解压unzip文件

    [root@gpslave1 home]# unzip greenplum-db-5.10.2-rhel7-x86_64.zip
    Archive:  greenplum-db-5.10.2-rhel7-x86_64.zip
      inflating: greenplum-db-5.10.2-rhel7-x86_64.bin  
    [root@gpslave1 home]# ll
    总用量 384496
    drwxr-xr-x. 2 root    root            6 9月   1 23:14 cdrom
    -rwxrwxrwx. 1 root    root           33 9月   2 17:45 cmd
    drwx------. 2 gpadmin gpadmin        62 9月  28 23:29 gpadmin
    -rwxr-xr-x. 1 root    root    197905185 8月  10 2018 greenplum-db-5.10.2-rhel7-x86_64.bin
    -rwxr-xr-x. 1 root    root    195802895 10月  9 02:01 greenplum-db-5.10.2-rhel7-x86_64.zip
    drwxr-xr-x. 2 root    root           76 9月   4 00:55 gz_test
    -rw-r--r--. 1 root    root          112 9月   4 00:43 gz_test.tar.gz
    -rwxrwxrwx. 1 root    root          113 9月   3 16:37 tar_test.tar
    -rwxrwxrwx. 1 root    root            0 9月   2 17:44 test.txt
    drwxr-xr-x. 3 root    root           34 9月   1 23:32 VMTools
    drwxr-xr-x. 9 root    root          175 11月 11 2015 vmware-tools-distrib

    参考:

    https://jingyan.baidu.com/article/9080802238d21dfd91c80fd5.html

  • 相关阅读:
    Js之Location对象
    Hibernate事务传播性
    Java异常基础Exception
    JVM垃圾回收机制
    JDK动态代理例子
    Hibernate之通过hibernate.cfg.xml配置文件访问数据库的例子
    开源wkhtmltopdf使用心得 (四)
    开源wkhtmltopdf使用心得 (三)
    开源wkhtmltopdf使用心得 (二)
    开源wkhtmltopdf使用心得 (一)
  • 原文地址:https://www.cnblogs.com/jenrrychen/p/15220286.html
Copyright © 2011-2022 走看看