linux under tar compression decompress folder command and parameters

  • 2020-05-12 06:43:41
  • OfStack

preface

tar is a commonly used packaging, compression and compression tool on linux. It has many parameters. This article only lists the commonly used compression and decompression parameters

1. Compress folders/files test to test.tar.gz in the current directory:


tar -zcvf test.tar.gz test

2. Unzip file.tar.gz to file in the current directory:


tar -zxvf file.tar.gz

Parameters,

One of the five commands must be selected

-c: create compressed files

- x: decompression

-t: view the content

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

-u: updates files in the original zip

These parameters are optional

-z: has the gzip attribute

-j: with bz2 properties

-Z: has compress properties

-v: shows all processes

-O: unzip the file to standard output

-f required parameter

-f: use the file name, this parameter is the last parameter, only the file name can be followed.

3, check the

View the contents of the compressed package without decompressing:


tar -tf test.tar.gz

conclusion

The above is linux tar compression decompression folder command and parameters of all the content, I hope the content of this article to your study or work can bring 1 definite help, if you have any questions you can leave a message to communicate.


Related articles: