Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the tar decompression commands?

2025-04-04 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly explains "what are the tar decompression commands". The explanation in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn what the tar decompression commands are.

There are many options for the tar command, which can be seen with tar-help. If you can't understand it, your English needs to be strengthened. There are only a few commonly used options. Here are some examples:

Format tar [OPTION...] [FILE]...

# tar-cf all.tar * .jpg

-c,-- create create a new archive means to generate a new package,-f,-- file=ARCHIVE use archive file or device ARCHIVE

# tar-rf all.tar * .gif

This command adds all .gif files to the all.tar package. -r,-- append append files to the end of an archive add files

To sum up.

1. Tar is decompressed with tar-xvf

2. *. Gz is decompressed with gzip-d or gunzip

3. * .tar.gz and * .tgz are decompressed with tar-xzf

4. * .bz2 decompress with bzip2-d or bunzip2

5. * .tar.bz2 decompress with tar-xjf

6. * .Z decompress with uncompress

7. Tar.Z is decompressed with tar-xZf

8. *. Rar decompressed with unrar e

9. *. Zip decompressed with unzip

The most important parameter of tar is that-f represents the name of the decompressed file

-c: create compressed files

-x: decompression

-t: view content

-r: appends files to the end of the compressed archive file

-u: update the files in the original package

These five parameters are independent parameters and will be combined with one of the expiration and other parameters when used. Other parameters include

-z: with gzip attribute

-j: with bz2 attribute

-Z: with compress attribute

-v: show all processes

-O: unlock files to standard output

[root@xsz ~] # du-sh test / / View file size

27M test

[root@xsz] # tar-cf test2.tar test / / package

[root@xsz ~] # du-sh test2.tar

26M test2.tar

Note: the size does not change much after packing.

Compression:

[root@xsz ~] # gzip test2.tar

[root@xsz ~] # ls

Anaconda-ks.cfg install.log install.log.syslog test test2.tar.gz test.tar xsz.tar

[root@xsz ~] # du-sh test2.tar.gz

8.7M test2.tar.gz

The compressed size of Gzip is 8pm 7m.

[root@xsz ~] # bzip2 test.tar

[root@xsz ~] # ls

Anaconda-ks.cfg install.log install.log.syslog test test2.tar.gz test.tar.bz2 xsz.tar

[root@xsz ~] # du-sh test.tar.bz2

7.5M test.tar.bz2

The compressed size of bzip is 7.5m.

So the compression degree, BZIP > GZIP > tar-cvf

= = decompress

Gzip-d etc1.tar.gz

Bzip2-d etc2.tar.bz2

Xz-d etc3.tar.xz

= = unpack

Tar-xf etc2.tar-C / var/tmp/-C is redirected to the / var/tmp directory

=

Method 2:

= = packing, compression = =

Tar-czf etc1.tar.gz / etc / /-z calls gzip

Tar-cjf etc2.tar.bz2 / etc / /-j calls bzip2

Tar-cJf etc3.tar.xz / etc / /-J calls xz

Unpack, decompress

Tar-xvf etc1.tar.gz / / there is no need to specify a decompression tool, tar will automatically judge

Tar-xvf etc2.tar.bz2-C / tmp

Tar xf etc3.tar.xz

=

= = decompress zip

[root@xsz ~] # unzip oracle.zip

Thank you for your reading, these are the contents of "what are the tar decompression commands?" after the study of this article, I believe you have a deeper understanding of what the tar decompression commands have, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report