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

Compress files tar and zip

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

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

compression software

I.Zip

1.zip file

[root@master test]# zip -r a.zip a

adding: a/ (stored 0%)

adding: a/b/ (stored 0%)

adding: a/c/ (stored 0%)

adding: a/c1 (stored 0%)

adding: a/b1 (stored 0%)

adding: a/a1 (stored 0%)

2. View compressed file contents without decompression

[root@master test]# unzip -l a.zip

Archive: a.zip

Length Date Time Name

0 10-11-2019 02:18 a/ 0 10-11-2019 02:17 a/b/ 0 10-11-2019 02:17 a/c/ 0 10-11-2019 02:17 a/c1 0 10-11-2019 02:17 a/b1 0 10-11-2019 02:17 a/a1 0 6 files

3. Decompress the specified files in the compressed package to the specified directory. If there is one, decompress all the files if there is none.

[root@master test]# unzip a.zip a/a1 -d aaaaa/

Archive: a.zip

extracting: aaaaa/a/a1

4. Decompression completed, check the decompressed file

[root@master test]# ls aaaaa/a/a1

aaaaa/a/a1

II.tar

1.tar compressed file

[root@master test]# tar -czvf a.tar.gz a

a/

a/b/

a/c/

a/c1

a/b1

a/a1

2. View compressed file contents without decompression

[root@master test]# tar -tvf a.tar.gz

drwxr-xr-x root/root 0 2019-10-11 02:38 a/

drwxr-xr-x root/root 0 2019-10-11 02:17 a/b/

drwxr-xr-x root/root 0 2019-10-11 02:17 a/c/

-rw-r--r-- root/root 0 2019-10-11 02:17 a/c1

-rw-r--r-- root/root 0 2019-10-11 02:17 a/b1

-rw-r--r-- root/root 0 2019-10-11 02:17 a/a1

3. Extract the specified files from the compressed package to the specified directory

[root@master test]# tar -zxvf a.tar.gz a/b1 -C aaaaa/

a/b1

III. Compression

1. compressed file

compress a.tar.gz

2. unzip the file

uncompress a.tar.gz.Z

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