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

How to use tar command to manipulate files in Linux

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

This article will explain in detail how to use the tar command to operate files in Linux. The content of the article is of high quality, so the editor shares it for you as a reference. I hope you will have some understanding of the relevant knowledge after reading this article.

Grammar

Tar [-] A-- catenate-- concatenate | c-create | d-- diff-- compare |

-- delete | r-- append | t-- list |-- test-label | u-- update | x

-extract-get [options] [pathname...]

Description

The original and authentic official saying is that Tar stores or extracts archives on tapes and hard drives.

Functional option

-a horse, a house, a house.

Add a file to the archive

-c,-- create

Create a tar file

-dwelling, talking, talking.

Find the difference between the archive and the current file

XMAG, extract, extract, get

Decompress the archive

Other options

-Cmam Murray directory

Change the catalog

-Fleming Musi file ARCHIVE

Specify a file or archive

-jmam Mutual Mutual bzip2

-Omam, Mushto, stdout.

-zjinghewashi, gzipqzipmam, QULLGUNZIPMAE, QULINGULYPY

-vmam MethoCom verbose

List the files processed in detail

Examples of usage

Compress it into a gzip file:

The code is as follows:

Tar-zcvf shell.tar.gz shell/

Extract the gzip file:

The code is as follows:

Tar-zxvf shell.tar.gz

Compress to a bz2 file:

The code is as follows:

Tar-jcvf shell.tar.bz2 shell/

Extract the bz2 file:

The code is as follows:

Tar-jxvf shell.tar.bz2

If you only want to package the files into tar packages without compressing them, it is also very simple:

The code is as follows:

Tar-cvf shell.tar shell/

Similarly, decompress and you will know:

The code is as follows:

Tar-xvf shell.tar

On how to use the tar command in Linux to operate the file is shared here, I hope the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

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

Servers

Wechat

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

12
Report