Linux Learning Notes (packaged compression tool)

Source: Internet
Author: User
Tags unpack

The backup of data is a key thing in the operation and maintenance process. There is no price for data.

Content:

  1. Several compression tools

    Compress
    Uncompress
    Old compression appliances are generally not available now.
    gzip:. GZ
    Gunzip
    Zcat Look at the text content without pressure.
    Note: The source files
    gzip-d file decompression files are deleted after compression
    gzip-# File Set decompression ratio-1-9 default is -6
    gzip–c filename  >/path/to/filename.gz can save the source file
    gunzip-c filename > /path/to/filename.g

    Bzip2:.bz (default delete source file)
    Bunzip2
    Bzcat
    Compression tool with a greater compression ratio than gzip
    -D: Unzip
    -#: Setting the compression ratio
    -K: Keep the original file when compressing

    XZ:. XZ (the default is to delete source files)
    Unxz
    Xzdec
    Xzcat
    Xz/path/to/somefile
    -D: Unzip
    -#: Specify compression ratio
    -K: Keep the original file when compressing
    Zip: A tool that can be archived and compressed Usage: Zip filename.zip FILE1 FILE2 ...: The original file is not deleted after compression
    Unzip Filename.zip
    tar is a very powerful command:
    instance:
    1. Package compression:
    TAR-CVF package.tar/mnt package only
    TAR-ZCVF PACKAGE.TAR.GZ/MNT packaged and compressed with gzip
    TAR-JCVF package.tar.bz2/mnt packaged and bzip2 compressed
    2. View:
    TAR-TVF Package.tar
    Tar- TZVF package.tar.gz
    TAR-TJVF package.tar.bz2
    3. Unpack the package:
    TAR-XZVF package.tar.gz Unpack the package to your directory.
    TAR-XJVF package.tar.bz2 Ibid.
    4. Unlock a single file.
    TAR-XZVF package.tar.gz filename
    5. Back up the files and save the permissions.
    Tar-czv
    -C Create a parameter directive (create) for a compressed file
    -X Unpack the parameter instructions for a compressed file
    -T view the files inside the tarfile.
    Special Note: The above parameters can only have one existence at a time.
    -F Use the file name. Note: This is directly followed by the file name, otherwise there will be an error.
    -V: Files are displayed during compression!
    -Z: Using gzip compression
    -J: Using bzip2 compression
    -P: Use original attribute of original file
    -P: You can use absolute path to compress!
    -N: Newer than the date next to it will be packaged into a new file!
    --exclude file: Do not package file in the process of compression!
    Cpio
    For detailed usage, you can refer to bird's private cuisine.
    Principle: File input and output via data stream redirection

    Summary: The above gzip, bzip2, and XZ are all compression tools. The ability to achieve compression and archive (archive) is zip and tar as well as cpio. Commonly used is tar.

  2. DD command

  3. DD Command:
    Instance:
    1. Back up the/etc/passwd to the/tmp/passwd.back
    DD If=/etc/passwd/of=/tmp/passwd.back
    2. Backing up the/DEV/SDA MBR
    DD IF=/DEV/SDA of=/tmp/mbr.back bs=512 count=1
    3. Back up the entire partition/dev/sda1
    DD if=/dev/sda1 Of=/some/path/filename

    Parameters:
    If: is the input file can also be a device
    Of: The output file can also be a device
    BS: Plan the size of a block, if not set is the post preset on 512bytes
    Count: How many BS means.

This article from "Technology first" blog, declined reprint!

Linux Learning Notes (packaged compression tool)

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.