Compression and archiving of Linux files

Source: Internet
Author: User
Tags bz2

  • Compress

     compress 文件名        -v 详细信息       -d 等于 uncompress 默认只识别 .Z       -c 输出的标准输出  再结合> 生成文件
      • Gzip

            gzip 文件名 压缩      -d 或 gunzip 解压  只识别.gz       -c 文件名 > 压缩包   压缩后保持原文件不变,但权限会根据umask变化       -cd 压缩包 > 文件名  或 zcat 压缩包 > 文件名 解压后保持压缩包不变,但权限会根据umask变化      -v 详细信息       -# 表示指定压缩比,默认是6 ,数字越小,表示压缩比越小,速度越快                反之,数字越大,压缩比越大,速度却越慢。
    • Bzip2

            -k 保持原文件或原压缩包不变      -d 或 bunzip2 解压        -c 文件名 > 压缩包  压缩后保持原文件不变,但权限会根据umask变化       -cd 压缩包 > 文件名  或 bzcat 压缩包 > 文件名 解压后保持压缩包不变,                 但权限会根据umask变化      -v 详细信息       -# 表示指定压缩比,默认是9,数字越小,表示压缩比越小,速度越快                    反之,数字越大,压缩比越大,速度却越慢。
    • Xz

       -K keeps the original file or the original compressed package unchanged-D or UNXZ unzip-C file > Compress package to keep the original file unchanged, but the permissions will vary according to Umask-CD Compression Package > Text                 File name or XZCAT package > FileName decompression keeps the package intact but the permissions vary according to Umask-V details-# represents the specified compression ratio, the default is 6, the smaller the number, the lower the compression ratio, the faster the speed Conversely, the larger the number, the greater the compression ratio, the slower the speed. 
        • Zip Oracle

              -r 压缩包名 源文件……    unzip 压缩包名    cat /var/log/messages | zip messages  -    unzip -p message > message
        • Tar * * *

                 -可以不要       -c 创建包       -v 详细过程         -f 指定生成后的文件名  源文件……        tar -tvf mage.tar  预览归档文件        tar -r /etc/fstab -f mage.tar  往归档中增加文件        tar --delete etc/fstab -f mage.tar 从归档中减少文件        tar -xv passwd -f mage.tar 从归档中解出指定的文件        tar -xvf mage.tar 从归档中解出所有文件        tar xvf mage.tar -C /app2 解压到指定目录,默认为当前目录       -j 使用bzip2 压缩或解压缩(可省略)      -J 使用xz 压缩或解压缩(可省略)      -z 使用gzip 压缩或解压缩(可省略)       tar jcvf mage.tar.bz2 *       tar xvf mage.tar.bz2
    • Split-b 3k-d mage.tar.xz mage-parts to split Mage.tar.xz

    • Cat mage-parts0 > Mage.tar.xz merge the split files
      • Cpio

               find |cpio -ov > find.cpio   归档       cpio -tv < find.cpio 或 cat find.cpio |cpio -tv  预览       cpio -idv < find.cpio  或 cat find.cpio |cpio -idv 解开

    Compression and archiving of Linux files

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.