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

Unzip command for file directory

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

Share

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

File directory compression / decompression

File compression / decompression-gzip/bzip/xz

1) gzip * .gz

Compression:

[root@localhost ~] # gzip / bbq/1.txt

[root@localhost ~] # ls / bbq/

1.txt.gz

[root@localhost ~] # file / bbq/1.txt.gz

/ bbq/1.txt.gz: gzip compressed data, was "1.txt", from Unix, last modified: Sat Sep 7 05:33:50 2019

Unzip:

[root@localhost] # gzip-d / bbq/1.txt

[root@localhost ~] # ls / bbq/

1.txt

2) bzip2 * .bz2

[root@localhost ~] # bzip2 / bbq/1.txt

[root@localhost ~] # file / bbq/1.txt.bz2

/ bbq/1.txt.bz2: bzip2 compressed data, block size = 900k

[root@localhost] # bzip2-d / bbq/1.txt.bz2

[root@localhost ~] # ls / bbq/

1.txt

3) xz * .xz

[root@localhost ~] # xz / bbq/1.txt

[root@localhost ~] # file / bbq/1.txt.xz

/ bbq/1.txt.xz: XZ compressed data

[root@localhost] # xz-d / bbq/1.txt.xz

[root@localhost ~] # ls / bbq/

1.txt

Create a package file-tar

1) create a package file * .tar

Tar cf package file name source file c: create create f: file file

[root@localhost bbq] # tar cf 1.tar 1.txt

[root@localhost bbq] # file 1.tar

1.tar: POSIX tar archive (GNU)

2) unpack

# tar xf package file name [- C directory name]

[root@localhost bbq] # tar xf 1.tar

[root@localhost bbq] # tar xf 1.tar-C / kvm/

3) View the files in the package

[root@localhost bbq] # tar tvf 1.tar

-rw-r--r-- root/root 0 2019-09-07 05:33 1.txt

Call gzip to compress / decompress beforehand

# tar czf package File name Source File

Z: call gzip

[root@localhost bbq] # tar czf / kvm/1.tar.gz / bbq/

[root@localhost bbq] # ls / kvm

1.tar.gz

Decompress

[root@localhost] # tar zxf / kvm/1.tar.gz-C / tmp/

Call bzip2 to achieve compression / decompression

# tar cjf package file name directory name

J: call bzip2

[root@localhost ~] # tar cjf / kvm/1.tar.bz2 / kvm/

Decompress

[root@localhost] # tar xjf / kvm/1.tar.bz2-C / tmp/

Call xz to achieve compression / decompression

Tar cJf package file name directory name J: call xz

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