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

Summary command-tar

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >

Share

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

Common parameters of tar

-c: create compressed files

-x: decompression

-t: view content

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

-u: update the contents of the compressed file

These five are independent commands, and one of them is used for compression and decompression. They can be used with other commands, but only one of them can be used.

The following parameters are optional when compressing or decompressing files as needed

-z: with gzip attribute

-j: with bz2 attribute

-Z: with compress attribute

-v: show all processes

-O: unlock files to standard output

The following parameter-f is required

-f: use the file name. Remember that this parameter is the last parameter and can only be followed by the file name.

Compression command: ending with various types

# compress all compressed files with a suffix of txt and a package ending with tar

# tar-cf a.tar * .txt

# ll a.tar

-rw-r--r-- 1 svnuser svnuser 61440 Apr 21 09:39 a.tar

# append new files to a.tar

# tar-rf a.tar * .bk

# update the file 1.bk in the archive

# tar-uf a.tar 1.bk

# View the files in the a.tar package

# tar-tf a.tar

Compound compression command

Tar-cf a.tar * .txt / / package all jpg files in the directory into tar

Tar-czf b.tar.gz * .txt / / after all the jpg files in the directory are packaged into tar and compressed with gzip, a gzip compressed package is generated that ends with tar.gz.

Tar-cjf c.tar.bz2 * .txt / / package all the txt files in the directory into tar and compress them with bzip2 to generate a bzip2 compressed package that ends with tar.bz2

Tar-cZf d.tar.Z * .txt / / package all the txt files in the directory into tar and compress them with compress to generate a umcompress compressed package that ends with tar.Z

Tar-czf f.tgz * .txt / / package all txt files in the directory as files at the end of tgz

Extract the tar compressed packet

# tar-xf a.tar / / decompress the compressed package at the end of tar

# tar-xzvf b.tar.gz / / decompress the compressed package at the end of tar.gz

# tar-xjvf c.tar.bz2 / / decompress the compressed package at the end of tar.bz2

# tar-xZvf d.tar.Z / / decompress the compressed package at the end of tar.Z

# tar-xzvf f.tgz / / decompress the compressed package at the end of tgz

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

Network Security

Wechat

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

12
Report