Linux Learning Notes (file Pack and unzip)

Source: Internet
Author: User
Tags bz2 rar

Common commands:


Zip:

Package: Zip something.zip Something (directory please add-r parameter)

Unpacking: Unzip something

Specify path:-d parameter

Tar

Package: TAR-ZCVF Something.tar Something

Unpacking: TAR-ZXVF Something.tar

Specify path:-C parameter


Compression/decompression tools commonly used on Linux,


Main explanation Zip,rar,tar


Before you talk about the compression tools on Linux, it's important to look at the commonly used compressed package file formats first.

The most common on Windows is a compressed file of these three *.zip,*.rar,*.7z suffixes,

And in Linux above common commonly used in addition to the above three kinds of

and *.gz,*.xz,*.bz2,*.tar,*.tar.gz,*.tar.xz,*.tar.bz2,

The following is a brief introduction:

 

File suffix name Description
*.zip Zip program to package compressed files
*.rar RAR Program Compressed files
*.7z 7zip Program Compressed Files
*.tar Tar program packaging, uncompressed files
*.gz Gzip (GNU Zip) compressed files
*.xz XZ Program Compressed Files
*.bz2 BZIP2 Program Compressed Files
*.tar.gz Tar packaging, gzip program compressed files
*.tar.xz Tar packaging, XZ program compressed files
*tar.bz2 Tar package, BZIP2 program compressed files
*.tar.7z Tar pack, 7z program compressed files



Command ZIP


Parameters:

Parameters Description
-R Indicates that a recursive package contains all the contents of a subdirectory
-Q Expressed as quiet mode, that is, does not output information to the screen
-O The output file must be followed by the package output filename
-(1-9) 1 means the fastest compression but the volume is large, 9 means the smallest volume but the longest time
-X Exclude Files
-L Convert LF to CR+LF (for Windows compatible)
-E To create an encrypted compressed package


Cases:


Zip-r-q-o Test.zip/usr/local/share

Zip-r-a-7-L Test.zip/usr/local/share


Du-h test.zip View Compressed file size


Command UNZIP (for extracting files)


Parameters

Parameters Description
-Q Use Quiet mode to extract files to the specified directory
-L View only the contents of a compressed package
-O (English letter, capital O) parameter specifies the encoding type

Cases:

Unzip Test.zip

Unzip-q test.zip-d/usr/loacl/share/

Unzip-l Test.zip

Unzip-o GBK Chinese compressed file. zip


RAR Packaging Compression

RAR is also a commonly used in Windows compressed file format, on Linux can use the RAR and Unrar tools

Create and decompress RAR packages separately

You need to install the software RAR unrar when using the RAR command

Yum install-y rar Unrar

Apt-get Install RAR Unrar


Parameters

Note: RAR command parameters are not-, if added will error

D Delete a file from the specified compressed package file

L View unresolved files






Tar pack command


Parameters:

Parameters Description
-C Create a parameter directive for a compressed file (the meaning of Create)
-X Unlock parameter directives for a compressed file
-T See the files inside the Tarfile
-Z Do you have properties for gzip at the same time? i.e. do I need gzip compression?
-j Do you have bzip2 properties at the same time? i.e. is it necessary to compress with bzip2?
-V Compress the process of displaying files! This is commonly used, but is not recommended for use in the background execution process!
-F Use the file name, please note, after F to immediately answer the file name Oh! Don't add any more arguments!
-P Use original file properties (attributes are not changed by user)
-P Uppercase You can use an absolute path to compress
-N
Newer than the later date (YYYY/MM/DD) will be packaged into the new file!

In particular, in the release of the parameters, c/x/t can only exist one! Cannot exist at the same time!

Because it is not possible to compress and decompress simultaneously.


1,. Tar with TAR–XVF decompression

2,. gz with gzip-d or gunzip decompression

3. tar.gz and. tgz Extract with Tar–xzf

4,. bz2 with bzip2-d or with BUNZIP2 decompression

5,. tar.bz2 with TAR–XJF decompression

6,. Z Extract with Uncompress

7,. Tar. Z Extract with Tar–xzf

8,. rar with Unrar e decompression

9,. zip with unzip decompression




This article is from the "Wang Yalin" blog, make sure to keep this source http://remover.blog.51cto.com/10472846/1963120

Linux Learning Notes (file Pack and unzip)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.