Write down the two most common rar commands
Package the www.2cto.com directory as www.2cto.com. rar
# Rar wwww.2cto.com. rar./www.2cto.com/
Decompress andy.rar to the current directory
# Rar x www.2cto.com. rar
CentOS + rar + unrar Installation
# Vi/etc/yum. repos. d/dag. repo
Add the following content
[Dag]
Name = Dag RPM Repository for Red Hat Enterprise Linux
Baseurl = http://apt.sw.be/redhat/el?releasever/en/?basearch/dag
Gpgcheck = 1
Enabled = 1
Gpgkey = http://dag.wieers.com/rpm/packages/RPM-GPG-KEY.dag.txt
Then install yum directly.
# Yum-y install rar unrar
Detailed explanation of rar + unrar commands
# Rar -- help
Usage: rar <command>-<Option 1>-<option N> <compressed file> <file...>
<@ File list...> <decompressed path \>
<Command>
A. Add the file to the compressed file.
C. Add compressed file comments (the comment size cannot exceed 62000 bytes)
Cf add file remarks (the file remarks are displayed when the 'V' parameter is used, and the maximum value cannot exceed 32767 bytes)
Ch changes the file Compression Parameters
Cw writes archive remarks to a specified file
D. delete an object from the archive.
E. decompress the file to the current directory (no subdirectories are created)
F. Refresh the files in the archive. (update the files generated after they are packaged. Do not add new files to the compressed archive)
I [par] = <str> search for specific characters in the file
K. Lock the file (any command that tries to change the content in the compressed file will be ignored)
L [t, B] list archives [technical, bare]
M [f] Move to the compressed file [only for files]
P print the file to the standard output
R patch compressed files
Rc reconstruction of lost volume shards
Rn rename the file in the compressed file
Rr [N] add data recovery records
Rv [N] Create recovery volume
S [name |-] conversion between compressed files and SFX (self-extracting files)
T test compressed file
U updates files in the compressed file
V [t, B] lists detailed information about compressed files [technical, bare]
X decompress to the complete path
<Option>
-Stop scanning of options
Ad append the file name to the target path
Ag [format] uses the current data to generate the compressed file name
Ap <path> set the path inside the archive
As synchronization file directory
Av sets authentication detection (only the registered version provides this function)
Av-Disable authentication Detection
C-Disable remark display
Cfg-Disable read settings
Cl to lowercase letters
Cu conversion name: uppercase letters
Delete the original file after df Compression
Dh open shared files
Ds disables name sorting for solid files
Delete files after dw Compression
E [+] <attr> sets file exclusion and inclusion attributes
Ed does not add an empty directory
En does not set the end block of the file
The ep name does not contain a path.
The ep1 name does not contain the basic file directory.
Ep3 expand the path to the fully-contained drive name
F. Refresh the file
Hp [password] encrypts file data and file headers
Id [c, d, p, q] to disable the message
Ierr sends all messages to standard error output
Ilog [name] records error logs to files (this function is only available for the registered version)
Inul disables all messages
Enable isnd
K. Lock the compressed file
Kb to keep corrupted files decompressed
M <0 .. 5> sets the compression level (0-storage... 3-default... 5-maximum)
Mc <par> set advanced Compression Parameters
Md <size> Dictionary size in KB (64,128,256,512,102, 2048, 4096 or A-G)
MS [ext; ext] stores the specified file type
N <file> only contains the specified file
N @ read the file name from the standard input to the contained content
N @ <list> include a file in a specified list file
O [+ |-] Set rewrite Mode
Ol saves symbolic connections for files as connections
Or automatically rename the file
Owner and group of live storage files saved by ow
P [password] set the password
P-No Password inquiry
R performs recursive operations on subdirectories.
R0 only uses the wildcard name for Recursive operations on sub-Directories
Rr [N] add data recovery records
Rv [N] Creation and recovery
S [<N>, v [-], e] Create solid File compression
S-Disable solid File compression
SC <chr> [obj] sets the specified string
Sfx [name]: Create an SFX File
Si [name] reads data from standard input
Sl <size> the size of the processed file is smaller than the specified value.
Sm <size> the size of the processed file is greater than the specified value.
T compressed Test File
Ta <date> processes files modified after the specified date. <date> Format: YYYYMMDDHHMMSS
Tb <date> processes files whose modification date is earlier than the specified date. <date> Format: YYYYMMDDHHMMSS
Tk maintains the initial time of the file
Tl sets the file time to the latest file time
Tn <time> process files newer than the specified time
To <time> process files older than the specified time
Ts <m, c, a> [N] storage or storage time (modify, create, access)
U Update file
V. Create an automatic volume or list all volumes
V <size> [k, B] Create a volume of the specified size = <size> * 1000 [* 1024, * 1]
Ver [n] file version control
Vn uses the old volume naming system
Vp stops before each volume
W <path> specifies the working directory
X <file> exclude specified files
X @ exclude the names of objects read from standard input
X @ <list> specifies the objects to be excluded from the specified list file.
Y. Set all answers to yes.
Z [file] remarks on reading compressed files from files
Note: The <command> section of rar does not contain the "-" number, and only the <option> section contains the "-" number. Pay attention to this.
Example 1: Add a file or directory to the compressed file and use the command. Deleting file (the original file1 file will be deleted after compression is completed. Note: The m command only operates on the file)
# Rar a abc.rar file1
Description: If a file1 file exists in the abc.rar file, the file1 file is updated. In addition, the original file1 file still exists in the current directory. To move the file1 file to file1.rar, run the m command. You can also perform this operation on the directory.
Note: If you only enter the "rar a file1.rar" command but do not have a file name or directory name, all the files and directories under the current directory will be compressed into the file1.rar file. Pay attention to this.
Example 2: Decompress the content in the abc.rarfile. You can use the EOR xcommand. Assume that the directory abc.rar contains a file named file1 and a directory named test. The directory test contains a file named file2,
# Rar e abc.rar
NOTE: With the ecommand, The file1 file in abc.rar, together with the file2 file in the test directory, will be decompressed to the current directory. If you want to keep the directory structure in the abc.rar directory, use the x command.
# Rar x abc.rar
Note: The file1 file and the test directory will be decompressed to the current folder.
Example 3: add comments to the entire compressed file
# Rar c abc.rar
Note: The command is displayed at the bottom of the screen.
Processing archive test.
RarReading comment from stdin
And there is a cursor flashing, from the cursor blinking position input comment information, input the end of the input press Ctrl + D
Example 4: add comments to a single file in the compressed file and use the cf Command. Now, add comments to the file1 file in the abc.rar file.
# Rar ch abc.rar file1
At the bottom of the screen
Reading comment for abc.rar: file1 from stdin
The comment to be added for file1 is flashed from the cursor, and Ctrl + D is used to end the input.
Example 4: Write the comment of the entire file into a file and use the cw command. To add abc.rarto the test.txt File
# Rar cw abc.rar test.txt
Description: The original content in plain text is written into text.txt.
Example 4: delete the file or directory in the compressed file and run the d command. For example, delete the file1 file in the abc.rar file.
# Rar d abc.rar file1
Note: This command deletes the file1 file in the abc.rar file, which is also valid for directories.
The preceding commands are commonly used for compression and decompression. The <option> section is not described. Please try it by yourself.
Unrar command:
# Unrar -- help
Usage: unrar <command>-<switch 1>-<switch N> <archive> <files...>
<@ Listfiles...> <path_to_extract \>
<Command>
E. decompress the file to the current directory.
L [t, B] list compressed document information [technical, bare]
P print the file to the standard output
T test compression I am Russian
V [t, B] lists detailed information about compressed documents [technical, bare]
X decompress the file to the complete path
The unrar command has the same effect as the rar command. It can be seen that the unrar command only contains a part of the rar command. Therefore, the rar command can be used to complete all operations.
From qeenoo's blog