How to decompress rar and zip files in Centos

Source: Internet
Author: User

How to decompress rar and zip files in Centos

Zip-r data.zip data

Explanation: The data folder is compressed into the data.zip format.

Unzip data.zip

Description: Decompress the data.zip file to the current folder.

Below are some detailed descriptions

1. I want to compress a file abc.txtand a directory dir1into yasuo.zip:

# Zip-r yasuo.zip abc.txt dir1

2. I downloaded a yasuo.zip file and want to decompress it:

# Unzip yasuo.zip

3. I have abc1.zip, abc2.zip, and abc3.zip under the current directory. I want to decompress them together:

# Unzip abc \?. Zip

Note :? Represents a single character. If "*" is used, it indicates any number of characters.

4. I have a large compressed file large.zip. I don't want to decompress it. I just want to see what it contains:

# Unzip-v large.zip

5. I downloaded a compressed file large.zip and want to verify whether the downloaded file is complete.

# Unzip-t large.zip

6. I used -v8.0 to find that there are many directories and subdirectories in the music.zip compressed file, and the subdirectories are actually mp3 files. I want to download these files to the first-level directory instead of the first-level directory:

# Unzip-j music.zip

Rarfile

The rarfile is not supported in liunx. You need to install winrar in liunx as follows:

Wget http://www.rarsoft.com/rar/rarlinux-4.0.1.tar.gz
Tar-zxvf rarlinux-4.0.1.tar.gz
Cd rar
Make

The following information indicates that the installation is successful.

Mkdir-p/usr/local/bin
Mkdir-p/usr/local/lib
Cp rar unrar/usr/local/bin
Cp rarfiles. lst/etc
Cp default. sfx/usr/local/lib

Remember two Common commands:

Rar x vpsyou.rar // extract vpsyou.rar to the current directory
Rar vpsyou.rar./vpsyou.com // package the vpsyou.com directory as vpsyou.rar

Common rar Commands include:

A. Add a file to the operation documentation.

For example, rar a test.rar file1.txt if the test.rarfile does not exist, package file1.txt to test.rar.

For example, rar a test.rar file2.txt if the test.rarfile already exists, then the file2.txtfile will be uploaded to test.rar.

(In this example, test.rar contains two files)

Note: If a copy of a file already exists in the Operation Document, the command updates the file and can also perform operations on the directory.

Example: rar a test.rar dir1

C. Add instructions to the Operation Document

Rar c test.rar

(The words "Reading comment from stdin" appear, enter one or more lines of comments, and end with ctrl + d)

Cf adds file comments, similar to c above, but this is to annotate each file in the compressed document

Cw writes document comments to files

Example: rar cw test.rar comment.txt

D. delete an object from the document

Example: rar d test.rar file1.txt

E. decompress the file to the current directory.

Example: rar e test.rar

Note: When Using efor decompression, not only the original file1.txtand file2.txt files are extracted to the current directory, but all the files in dir1

It is also decompressed to the current directory, and the directory structure before compression cannot be maintained. if you want to maintain the directory structure before compression, use x to decompress

K lock document

For example, after rar k test.rar locks the document, it cannot be updated.

R repair document

Example: rar r test.rar

When there is a problem with the rarfile, you can use this command to fix it (the ghost knows how many problems are used)

S conversion document into self-extracting document

Example: rar s test.rar

An executable test. sfx file is generated. Running this file is equivalent to rar x test.rar,

Suitable for transferring files to users without rar

T detection document

Example: rar t test.rar

Test the integrity of test.rar. Generally, it is best to use this command to ensure file correctness before compression of large files for transmission.

X. Extract the content from the file to the current directory.

Example: rar x test.rar

In this way, dir1 maintains the original directory structure.

The preceding are common rar commands. A single rar operation can only have one command, but multiple options can exist.

There are many rar options, which cannot be described here. Only a few of them are often used.

Cl converts a file name to lowercase

Cu converts a file name to uppercase

Example: rar a-cl test.rar FILe.txt

File.txt changes to file.txt after test.rar.

Delete source files after df operations

Example: rar a-df test.rar file1.txt file2.txt dir1

After you compress file1.txt,file2.txtand dir1to test.rar, delete the source file.

Ed does not add an empty directory

Example: rar a-ed test.rar dir1

When nvidir1to test.rar, no operation is performed on the empty directory.

Rar e-ed test.rar

When test.rar is decompressed, no empty directory is generated

K. Lock the file

Example: rar a-k test.rar file1.txt

Equivalent to rar a test.rar file1.txt

Rar k test.rar

M <0 .. 5> sets the compression ratio level (0-storage, 3-default, 5-maximum)

Example: rar a-m0 test.rar dir1 dir2

Store dir1,dir2into test.rar without substantial compression (fast and suitable for operations on files without any pressure)

Such as avi and jpg)

Rar a-m5 test.rar *. txt *. bmp

Compress the TXT and BMP files in the current directory to test.rar and use the maximum compression ratio (slowest)

MS [ext; ext] specific files are not compressed

Example: rar a-m5-ms avi; jpg; jpeg test.rar/home

Archive all directories and files under the Home Directory to test.rar. Use the maximum compression, but do not compress avi, jpg, and jpeg files.

(Only package test.rar, because these files cannot be compressed with the maximum compression, it is better to directly package and save time)

O + overwrite existing files

O-Do Not Overwrite existing files

Example: rar x-o-test.rar

Decompress the test.rar file. However, if an existing file exists, it is not overwritten.

Ol saves symbolic links as link files, instead of normal files

Ow stores or restores the information of the file owner (username, group)

These two commands are unique to the * nix system. They are easy to understand.

P [password] set the password

Example: rar a test.rar *. txt-p prettygirl

Set the password of the compressed file to prettygirl. You cannot perform operations without a password during decompression.

If you think the plaintext password is too exposed, you can use

Rar a test.rar *. txt-p

Then, the rar program will ask you what password you want to use, without echo

S-do not use solid Compression

Note: solid compression is an unchangeable compression method for document content after compression, which is different from lock. Because common compression is used

To take care of the need to insert and delete individual files in the future, a lot of operation is required. However, solid compression cannot

Its content is updated, so the compression ratio is the largest.

Sfx [name] is used to create a self-extracting file, which is the same as compressing with a and converting with s.

T compression is complete before integrity test

Example: rar a test.rar/home-t

Perform the test after compression is completed. If any problem occurs, an error is returned.

Ta only operates on files after the data date

Tb only performs operations on files before the data date

Note: the format of date is YYYYMMDDHHMMSS.

V [k, B] split-volume compression. The size of each volume is specified by the subsequent size.

Example: rar a-v15000k-m0 test xvid-fn.avi

Packaging and storage of xvid-fn.avi, 15000 k per volume (this format is popular when dvdrip is published online)

The generated file is test.part1.rar,test.part2.rar .... (Rar Version 3.20)

X exclude specific files

Example: rar x test.rar-x *. txt

Decompress documents except *. txt in test.rar

X @ is the same as above, but all excluded files are placed in the list file list this time.

Y. All operations are answered yes.

For example, if you encounter the same file during decompression, you can ask whether to overwrite (Y/N). If you add-y, you can select Yes by default.

Related Article

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.