zoukankan      html  css  js  c++  java
  • 压缩归档tar命令

    归档有两个命令,一个是tar命令,一个是cpio

    归档不删除原文件

    tar命令语法:

    tar cvf aa.tar file1 file2 file3 file4 file5

    # tar cvf bb.tar a01.txt a-1.txt a3.txt a4.txt a5.txt

    归档并删除原文件

    添加--remove-files

    # tar cvf bb.tar *.txt --remove-files

    查看归档里面的文件

    #tar -t -f aa.tar

    解档

    常用:

    tar zxf **.tar

    #tar xvf aa.tar

    压缩工具:

    # yum install -y unzip zip

    gzip

    bzip2

    zip

    dd命令对block进行复制,if输入,of输出,bs指定大小(默认B),count数量

    # dd if=/dev/zero of=file bs=1M count=100

    查看

    # ls -lh file

    gzip压缩

    # gzip file

    gzip解压

    # gzip -d file.gz 

    bzip2压缩、解压

    # bzip2 file 

    # bzip2 -d file.bz2

    zip压缩、解压

    # zip file.zip file 

    unzip解压

    解压到当前目录

    语法:

    # unzip file.zip 

    解压到指定目录

    # unzip file.zip -d 路径

     

    zip 压缩目录加-r

    # zip -r mnt.zip /mnt/

    归档压缩

    用法:

    tar zcvf aa.tar.gz file1 file2 file3

    # tar zcvf aa.tar.gz *.txt --remove-files

    生成带时间戳的归档压缩文件

    # tar zcf wizdata_$(date +%Y%m%d-%H%M).tar.gz wizdata

    归档解压

    -C指定目录

    # tar zxvf aa.tar.gz -C /mnt/

    bzip2归档压缩

    # tar jcvf aa.tar.bz2 *.txt --remove-files

    解压

     # tar jxvf aa.tar.bz2 

  • 相关阅读:
    函数式语言(老师作业)
    session/cookie
    Linux根目录下各个目录的功能介绍
    Navicat12安装文件和破解补丁
    正则表达式验证示例
    RequestDispatcher接口示例
    hello2部分源码解析
    Introduction of Servlet Filter
    关于hello1中的web.xml解析
    Annotation解释
  • 原文地址:https://www.cnblogs.com/djlsunshine/p/9839585.html
Copyright © 2011-2022 走看看