zoukankan      html  css  js  c++  java
  • 打包与压缩命令

    打包命令tar,linux没有文件后缀,跟windows不同,为了区分好文件类型,要自己加

    cvf的意思是创建文件,v显示哪些文件打包,f test.tar打包后的文件名,a.txt b.txt要打包的文件,打包意思是归档,不是压缩。

    [root@localhost ~]# tar cvf test.tar a.txt b.txt

    a.txt

    b.txt

    [root@localhost ~]# tar cf test.tar1 a.txt b.txt

    要查看打包文件内有什么文件

    [root@localhost ~]# tar -tf test.tar

    a.txt

    b.txt

    解开打包文件xf

    [root@localhost ~]# tar xf test.tar

    [root@localhost ~]# ls

    解压到/root/test/bar下

    [root@localhost ~]# tar xf test.tar -C /root/test/bar

    [root@localhost ~]#

    压缩文件

    [root@localhost ~]# gzip a.txt

    解压缩

    [root@localhost ~]# gunzip a.txt.gz

    打包压缩到某个文件夹中

    tar cf dabao.tar a.txt b.txt

    gzip dabao.tar

    也可以

    tar cfz dabao1.tar.gz a.txt b.txt

    tar cfjv dabao2.tar.bz2 a.txt b.txt

    bzip2 a.txt

    解压

    [root@localhost ~]# tar xf dabao1.tar.gz -C /root/dabao

    [root@localhost ~]#

    压缩文件夹

    tar cfz yasuo.tar.gz /etc/

    [root@localhost ~]# tar  -tf yasuo.tar.gz |less

    解压后带上etc,

    [root@localhost ~]# mkdir congcong

    [root@localhost ~]# tar xf yasuo.tar.bz2 -C /root/congcong

    [root@localhost ~]# ls congcong

    etc

    [root@localhost ~]#

    如果不想带etc,只要里面的文件

    [root@localhost /]# cd /etc

    [root@localhost etc]# tar czf dapigu.tar.gz *

    [root@localhost /]# tar xf /etc/dapigu.tar.gz -C /congcong

    [root@localhost /]# ls congcong

  • 相关阅读:
    控制流测试与条件测试
    12306的“短信公众号”到底是个啥?
    ISTQB名词辨析
    ISTQB TA
    启动Chrome时自动开启开发者模式
    LoadRunner Community Edition 12.60 无法获取Community License
    用言的活用声调变化规则
    ISTQB TTA大纲中提到的参考书目
    Java调用方法参数究竟是传值还是传址?
    Java中的Lambda表达式简介及应用
  • 原文地址:https://www.cnblogs.com/jensenxie/p/7815135.html
Copyright © 2011-2022 走看看