[Linux] Unzip the tar.gz file, unzip some files

Source: Internet
Author: User
Tags gz file

Encountered the database can not find the cause of the problem, can only find the log, find the log when the old log is compressed, only to try to extract the

A large amount of data, only in production decompression, and then to find

The file name is *.tar.gz, and your blog has previously documented the decompression method:

Http://www.cnblogs.com/garinzhang/archive/2013/04/23/3037147.html

Use TAR–ZXVF *.tar.gz can not decompress, obviously good tar.gz file can this decompression, why not unzip?

Later thought, is not the first to extract *.gz files, using Gunzip *.tar.gz to extract the success, extracted the file name is: *.tar

Because the log document is more relevant, occupy a large space, is using the tar xvf *.tar decompression, found that many files extracted, and the time is very long, the final decision to stop decompression, in the mind to think, is there a way to extract only a part of the file it

So a search, and found that there is really this method:

Http://blog.chinaunix.net/uid-10697776-id-2935568.html

Http://bbs.chinaunix.net/thread-1770627-1-1.html

In the article, you can use the following methods to view the contents of a compressed file:

TAR–TZVF *.tar.gz (because I am a. tar file at this time, so use TAR-TVF), and see that you can actually view the contents of a compressed file

Use the following methods to decompress:

Unzip a single file:

TAR–ZXVF *.tar.gz/test/filename.txt

Unzip multiple files:

TAR–ZXVF *.tar.gz/test/filenam*

Unzip to the specified directory:

TAR–ZXVF *.tar.gz/text/filename.txt–c/opt/targetfolder

The above commands cannot be executed on our production, and finding the relevant documents is due to the fact that Aix is not the same as other versions of Linux:

0. Afraid of the production of extracting files, the disk explosion, first check the disk situation (using DF-G, in GB display,-m in megabytes), display and 63GB:

Efbill_2:[/opt/oecs-g2/log/backup/compressed] #df-G
File system GB block available%used iused%iused installed on
/DEV/HD4 5.00 4.52 10% 10570 1%/
/DEV/HD2 48.00 45.26 6% 57427 1%/usr
/dev/hd9var 24.50 23.90 3% 8549 1%/var
/DEV/HD3 5.00 4.84 4% 348 1%/tmp
/dev/fwdump 1.00 1.00 1% 6 1%/var/adm/ras/platform
/DEV/HD1 5.00 5.00 1% 1%/Home
/dev/hd11admin 5.00 5.00 1% 5 1%/admin
/proc-----/proc
/dev/hd10opt 119.50 63.32 48% 22030 1%/opt

1. First look at the Linux version

efbill_2:[/opt/oecs-g2/log/backup/compressed]#cat/proc/version
6 2010
13:36:14
1032a_61l
@ (#) _kdb_buildinfo unix_64 6 13:36:14 1032a_61l
efbill_2:[/opt/oecs-g2/log/backup/compressed]#uname-a
AIX
efbill-2 1 6 00f764bd4c00

2. Search keywords: Aix tar.gz extract, find the answer:

Http://blog.sina.com.cn/s/blog_4b055d6b0100s711.html

The most common compressed file on AIX is. tar files, and in addition to the tar file, sometimes you will encounter the data is in other compressed file format, so I tidy up some common compressed file format, how to extract the Aix:

*.tar. Z file format

o Compression §# compress Filename.tar

o unzip §# zcat filename.tar.z | TAR-XVF-

*.tar.gz file format

O compress §# tar cvf-folder | gzip > filename.tar.gz

o unzip §# gunzip-c filename.tar.gz | TAR-XVF-

*.zip file Format (Note 1)

O Decompression §# Unzip Filename.zip

*.TGZ file format

o unzip §# gzip-d filename.tgz | TAR-XVF-

Note 1: Note that Aix presets do not have a unzip program, so you can go here and grab it and install it.

3. Unzip successfully, again need to try to extract only a subset of files out

Combined with the facial decomposition pressure file, tried several times to finally find a way:

1. Show All Files:

Efbill_2:[/opt/oecs-g2/log/backup/compressed] #gunzip-C 20140401_09.tar.gz | TAR–TVF-

2. Extract some of the files:

Single File:

Efbill_2:[/opt/oecs-g2/log/backup/compressed] #gunzip-C 20140401_09.tar.gz | tar-xvf-20140407110630/billing.log.40

3. Multiple files: Seemingly unable to follow the previous method of decompression, anyway, the goal has reached the

Related Article

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.