Linux compression and decompression example

Source: Internet
Author: User
Linux compression and decompression example-general Linux technology-Linux technology and application information. The following is a detailed description. Example 1: create a full-part sub-directory file named usr.tar in the/home directory.
$ Tar cvf usr.tar/home

Example 2: complete the sub-directories in the/home directory and compress them with the name usr.tar.gz.
$ Tar czvf usr.tar.gz/home

Example 3: Restore and decompress the backup file usr.tar.gz.
$ Tar xzvf usr.tar.gz

Example 4: The contents of the usr.tar backup file are displayed on the display in split screen mode.
$ Tar tvf usr.tar | more
To back up a file to a specific device, you only need to use the device name as the backup file name.

Example 5: compress a Tartar file, for example, usr.tar. the extension name of the compressed file is .tar.gz.
$ Gzip usr.tar

Example 6: extract text.zip from the current directory.
$ Unzip text.zip

Example 7: extract the compressed file text.zip under the specified directory/tmp. If the same file already exists, the unzip command must not overwrite the original file.
$ Unzip-n text.zip-d/tmp

Example 8: Decompress the lnx.cpio.gz File
Two methods
Zcat lnx.cpio.gz | cpio-idmv
Or
Gunzip lnx.cpio.gz
Cpio-idmv <lnx. cpio \

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.