Simple use of the tar command under Linux and related error resolution method

Source: Internet
Author: User

Tar is the most common packaging and compression tool under Linux, which plays a role similar to WinZip or WinRAR under Windows in Linux. Here is the tool's common command parameters and application examples:
Main commands:
-C Create Package
-X Solution Package
-T list the contents of the package
-R to add files to the specified package
-U update files in package
Optional command:
-j when creating or unpacking a package using bzip2 for compression or decompression;
-Z use gzip to compress or decompress when creating or unpacking a package;
-Z uses compress for compression or decompression when creating or unpacking a package;
-F followed by the specified package filename;
-V Display Package/unpack process
-c Specifies the path after the package is extracted
For example:
TAR-CZF tmp.tar.gz/tmp the "/tmp" directory compression package for tmp.tar.gz;
Tar-xzf tmp.tar.gz-c/home The tmp.tar.gz package to the "/home" directory;
Tar-t tmp.tar.gz View the file information in the tmp.tar.gz package;
Tar decompression problem
As shown below, you encounter errors such as "Gzip:stdin:not in gzip format" When you extract files using TAR-ZXVF:

The code is as follows:

[Root@db-server tmp]#
[Root@db-server tmp]# TAR-ZXVF Percona-xtrabackup-2.2.12-r8726828-el5-x86_64-bundle.tar
Gzip:stdin:not in gzip format
Tar:child returned status 1
Tar:error exit delayed from previous errors
Finally found that this package is not compressed with the GZIP format, so do not add Z parameter, shame!

The code is as follows:

[Root@db-server tmp]# TAR-XVF Percona-xtrabackup-2.2.12-r8726828-el5-x86_64-bundle.tar Percona-xtrabackup-2.2.12-1.el5.x86_64.rpmpercona-xtrabackup-debuginfo-2.2.12-1.el5.x86_64. Rpmpercona-xtrabackup-test-2.2.12-1.el5.x86_64.rpmyou have new mail in/var/spool/mail/root[root@db-server tmp]#

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.