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

  • 相关阅读:
    面向对象设计原则
    面向对象设计流程
    mysql远程连接命令(转)
    如何使用matplotlib绘制一个函数的图像
    svn:ignore eclipse开发一般忽略文件
    zookeeper client 常用操作
    pip使用
    vi常用快捷键
    python常用函数
    RabbitMQ 学习记录
  • 原文地址:https://www.cnblogs.com/jensenxie/p/7815135.html
Copyright © 2011-2022 走看看