Linux file compression and decompression

I. Introduction

Compression program under hfa Linux there are tar, gzip, gunzip, bzip2, compress, uncompress, zip, unzip, rar, unrar and other summarizes some of the following .tar, .gz, .tar.gz, .bz2, .tgz, tar. bz2, .Z, .tar.Z, .zip, .rar operation of these compressed files.

Second, the operation command

1, tar is the most commonly used Linux packager. It is just a packaging tool, is not responsible for compression.

Use the command man tar look at the help files command.

Here is an example of a packaged file:

The desktop yao.txt package:

Parameter Description

-c is to create a new document

-v displays detailed document processing

-f specify archive or device

[yao@localhost 桌面]$ tar -cvf yao.tar yao.txt
yao.txt
[yao@localhost 桌面]$ 

 After unpacking the package:

[yao@localhost 桌面]$ tar -xvf yao.tar
yao.txt
[yao@localhost 桌面]$ 

If you want to create a new directory, then add the new parameters like -C, as follows:

This directory should exist, does not exist error.

2, ZIP format

zip format is probably the most used file compression format. His greatest strength is used on different operating system platforms. The disadvantage is to support the compression rate is not very high, but in tar.gz and tar.bz2 compression ratios do very well.

We Desktop yao.txt compression as an example:

[yao@localhost 桌面]$ zip -r yao.zip yao.txt
  adding: yao.txt (stored 0%)
[yao@localhost 桌面]$ ls
yao.txt  yao.zip
[yao@localhost 桌面]$ 

 

Unzip the file:

-d is extracted to a new folder, the folder does not exist, then it is automatically created.

Guess you like

Origin www.cnblogs.com/1328497946TS/p/11546247.html