Get the App
SLTechnology News&Howtos  ›  Servers  › 

How to use gunzip and tar together

Shulou Source: shulou.com Published: 2022-06-01 00:29:24 09月22日 Update

This article mainly shows you "how to use gunzip and tar", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to use gunzip and tar" this article.

We can use gunzip combined with the tar command to extract all the files named test from the tar package

Gunzip-dc 2010-07-31.tar.gz | tar xvf-test.*

Execution result:

Test.2010-07-31.00.192.168.1.231

Test.2010-07-31.01.192.168.1.231

.

Successful, of course, this package must have a file with the name of test, otherwise something will go wrong.

In addition, tar does not support the use of wildcard characters (*,?) To find someone who matches the project:

Tar-zxvf 1.tar.gz "bin/a*"

Tar: Pattern matching characters used in file names. Please

Tar: use-wildcards to enable pattern matching, or-no-wildcards to

Tar: suppress this warning.

Tar: bin/a*: Not found in archive

Tar: Error exit delayed from previous errors

Find something wrong, unless you use-- wildchards collocation:

Tar-wildcards-zxvf 1.tar.gz "bin/a*"

Bin/ash

Bin/awk

Bin/arch

Please note that when passing in wildcard characters, wrap them with "or", otherwise shell will explain it first and tar will not see it.

In addition, the wildcards parameter is not available in REDHAT 9, but in RHEL AS4.

The above is all the content of the article "how to use gunzip and tar together". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Content articles characters documents learning help success parameters names commands easy to understand more organization knowledge results editing industry or information information channels Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft vpn Redmi MariaDB Apple