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

How to use RAR under linux operating system

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

Share

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

This article mainly shows you "how to use RAR under linux operating system", the content is simple and easy to understand, organized clearly, I hope to help you solve doubts, let Xiaobian lead you to study and learn "how to use RAR under linux operating system" this article bar.

================

zip -r data.zip data

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

unzip data.zip

Explanation: Extract the data.zip file into the current folder.

-----------------------------------

1. I want to compress a file abc.txt and a directory dir1 into yasuo.zip:

# zip -r yasuo.zip abc.txt dir1

2. I downloaded a yasuo.zip file and wanted to unzip it:

# unzip yasuo.zip

3. I currently have abc1.zip, abc2.zip and abc3.zip in my directory and I want to unzip them together:

# unzip abc\?. zip

Comments: ? Represents one character, if * represents any number of characters.

4. I have a large compressed file large.zip, I don't want to unzip it, just want to see what's inside:

# unzip -v large.zip

5. I downloaded a compressed file large.zip and wanted to verify that the compressed file was downloaded completely

# unzip -t large.zip

6. I use the-v option to find that music.zip has many directories and subdirectories, and the subdirectories are actually song mp3 files. I want to download these files to the first level directory instead of building directories layer by layer:

# unzip -j music.zip

=========================

In liunx originally does not support rar files, you need to install the winrar version under liunx, the operation is 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

See the following information is successful installation

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/ vpsyou.com directory as vpsyou.rar

-----------------------------------------------------

Rar commands are mainly used

a Add files to operation documents

Example:rar a test.rar file1.txt If the test.rar file does not exist, package the file1.txt file into test.rar

Example:rar a test.rar file2.txt If test.rar file already exists, add file2.txt file to test.rar

(There are two files in test.rar.)

Note: if a copy of a file already exists in the action document, the a command updates the file and can also operate on directories

Example:rar a test.rar dir1

c Add explanatory notes to the operation document

rar c test.rar

(Reading comment from stdin appears, followed by one or more lines of comment, ending with ctrl+d)

cf Add file comments, similar to c above, but this one comments each file in the compressed document

cw writes document comments to a file

Example:rar cw test.rar comment.txt

d Delete files from documents

Example:rar d test.rar file1.txt

e Extract files to current directory

Example:rar e test.rar

Note: If you use e to extract, not only the original file1.txt and file2.txt are extracted to the current directory, but also all the files in dir1.

Also decompressed to the current directory, can not maintain the directory structure before compression, if you want to maintain the directory structure before compression, with x decompression

k Lock Document

Example:rar k test.rar After the document is locked, the document cannot be updated.

r Repair documents

Example:rar r test.rar

When rar files have problems, you can try to fix them with this command (God knows how many)

s Convert documents to self-extracting documents

Example:rar s test.rar

An executable of test.sfx is generated, and running it has the effect of rar x test.rar,

Suitable for transferring files to users without rar

tDetect documents

Example:rar t test.rar

Check the integrity of test.rar. Generally, it is best to use this command to ensure the correctness of large files before they are compressed and ready for transmission.

x Extract the contents of the document with a path to the current directory

Example:rar x test.rar

If you unzip it this way, dir1 will retain its original directory structure.

The above is the common command of rar, a rar operation can only have one command, and options can have multiple.

------------------------------------------------------------------------

rar options are many, in this can not explain one by one, only a few demonstration frequently used

cl Convert file names to lowercase

cu Convert file names to uppercase

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

FILe.txt becomes file.txt when added to test.rar

df Delete source files after document operation

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

After compressing file1.txt,file2.txt,dir1 into test.rar, delete the source file

ed does not add empty directories

Example:rar a -ed test.rar dir1

When adding dir1 to test.rar, do not operate on empty directories

rar e -ed test.rar

When extracting test.rar, no empty directory is generated

k Lock file

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

Equivalent to rar a test.rar file1.txt

rar k test.rar

m Set compression ratio level (0-Storage, 3-Default, 5-Maximum)

Example:rar a -m0 test.rar dir1 dir2

Store dir1,dir2 packaged in test.rar without substantial compression (extremely fast, suitable for operating on files that are not very compressible

AVI, JPG, etc.)

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

Package and compress txt files and bmp files in the current directory into test.rar, using the maximum compression ratio (slowest)

ms[ext;ext] Specific files are uncompressed

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

Archive all directories and files in your home directory to test.rar, using maximum compression, but not avi,jpg,jpeg files

(Just pack it into test.rar, because these files can't be compressed much even with maximum compression, so it's better to pack them directly to save time)

o+ Overwrite existing files

o-Do not overwrite existing files

Example:rar x -o- test.rar

Extract the test.rar file, but do not overwrite if you encounter existing files

ol Save symbolic links as link files instead of regular files

ow Save or restore file owner information (username,group)

These two commands are unique to the *nix system, so it's easy to understand.

------------------------------------------------------------------------

p[password] Set password

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

Compressed file password set to prettygirl, decompression without password can not be operated

If you feel that the password is too exposed, you can use the clear code

rar a test.rar *.txt -p

The rar program asks you what password you want to use, without echoing it.

s-No solid compression is used

Note: Solid compression is a compression method in which the content of the compressed document cannot be changed, which is different from lock. Because normal compression is used

To accommodate the need to insert and delete individual files later, there is a lot of room for manoeuvre. And solid compression is not possible

Its contents are updated at any time, so the compression ratio is the largest.

sfx[name] creates a self-extracting file, which is the same as compressing with a and then converting with s.

tIntegrity check after compression

Example:rar a test. rar/home -t

After compression, check, if there is a problem, report an error.

ta operates only on files after data date

tb operates only on files before the data date

Note that the format of date is YMMDDHHMMSS.

v[k,b] is compressed in volumes, the size of each volume is specified by the size that follows

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

Store xvid-fn.avi packaged in volumes of 15000k (this format was popular when dvdrip was published online)

The generated file names are test.part1.rar,test.part2.rar…. (rar Version 3.20)

x Excludes certain files

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

Extract files from test.rar except *.txt

x@ Same as above, but this time all excluded files are placed in the list file list

Yes to all operations.

For example, sometimes when decompressing, ask if you want to overwrite (Y/N) every time you encounter the same file, add-y to select Yes by default, no longer ask

The above is "how to use RAR under linux operating system" all the contents of this article, thank you for reading! I believe that everyone has a certain understanding, hope to share the content to help everyone, if you still want to learn more knowledge, welcome to pay attention to the industry information channel!

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