CentOS installation rar and usage

Source: Internet
Author: User
Tags unzip rar

The installation procedure is as follows:
1. Download the rar installation package
: Bytes.

2. Install rar

[root@localhost download]# ls # view the downloaded rar installation package
Rarlinux - 32 bit - 4.2.0. Tar. Gz rarlinux - x64-4.2.0. Tar. Gz
Tar-zxvf rarlinux-x64-4.2.0.tar.gz # unzip rar
Rar /
Rar/technote. TXT
Rar/order. HTM
Rar/acknow. TXT
Rar/readme. TXT
Rar/rar_static
Rar/default. SFX
Rar/license. TXT
Rar/rarfiles. LST
Rar/whatsnew. TXT
Rar/makefile
Rar/rar
Rar/unrar
Rar/rar. TXT
[root@localhost download]# CD rar # go to directory installation
[root @ localhost rar] # ls
Acknow.txt makefile rarfiles.lst readme.txt whatsnew.txt
Default. SFX order. HTM rar_static technote. TXT
License. TXT rar rar. TXT unrar
# make [root @ localhost rar]
The mkdir -p/usr/local/bin
The mkdir -p/usr/local/lib
Cp rar unrar/usr/local/bin
Cp rarfiles. LST/etc
Cp default. SFX/usr/local/lib
The following message appears [root@localhost rar]# rar # to indicate that rar has been installed successfully

RAR 4.20 Copyright (c) 1993-2012 Alexander Roshal 9 Jun 2012
Trial version Type RAR -? For the help

Usage: rar <command></command> -<switch 1=""> -<switch n=""> <archive> <files...< span=""> ></files...<></archive></switch></switch>
The < @ listfiles... > < path_to_extract \ >

The < Commands >
A: Add files to archive
C the Add archive the comment
Cf the Add files to the comment
Ch Change archive the parameters
Cw Write archive comment to file
D Delete files from archive
E Extract files to current directory
F Freshen files in archive
I [par]=< STR > Find string in archives
K Lock archive
L [t,b] List archive [technical, bare]
M [f] Move to archive [files only]
P Print file to stdout
R Repair archive
Rc Reconstruct missing volumes
Rn Rename archived files
Rr [N] Add data recovery record
The rv [N] Create recovery volumes
S [name|-] Convert archive to or from SFX
T Test archive files
U Update files in archive
V [t,b] Verbosely list archive [technical,bare]
X Extract files with full path

The < Switches >
- Stop switches scanning
@[+] Disable [enable] file lists
AD Append archive name to destination path
Ag [format] Generate archive name using the current date
Ai Ignore the file attributes
.
[root @ localhost rar] #  

3. rar command usage
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)
[Root @ localhost ~] # Rar a abc.rar file1
Note: If a file1 file already exists in the abc.rar file, the file1 file will be updated. And the original file1 file still exists in the current directory. If you want to move file1file 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,
[Root @ localhost ~] # Rar e abc.rar# Not recommended
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.
[Root @ localhost ~] # Rar x abc.rar# Recommendation
Note: The file1 file and the test directory will be decompressed to the current folder.

Example 3: add comments to the entire compressed file
[Root @ localhost ~] # 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. If you want to add comments to the file1 file in the abc.rar file
[Root @ localhost ~] # 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
[Root @ localhost ~] # Rar cw abc.rar test.txt
Note: If a file named test.txt does not exist in the current directory, a file named test.txt will be created and written into the text.txt Text Example file.

Example 5: delete the files or directories in the compressed file and run the d command. For example, delete the file1 file in the abc.rar file.
[Root @ localhost ~] # Rar d abc.rar file1
Note: This command deletes the file1 file in the abc.rar file, which is also valid for directories.

Unrar command:
[Root @ localhost ~] # 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.

The parameters are as follows:
<Command>

A add file to zip file
C add archive comments (the maximum size of comments cannot exceed 62000 bytes)
Cf add file remarks (show file remarks when using 'v' parameter, Max. 32767 bytes)
Ch changes the archive parameters
Cw writes a file note to the specified file
D delete the file from the archive
E unzip the file to the current directory (no subdirectories are created)
F refresh the files in the archive (update the changes to these files since they were packaged, not add new ones to the archive)
I [par]=< STR > looks for specific characters in the file
Lock the file (any command that attempts to change the contents of the compressed file will be ignored)
L [t,b] list archives [technical, bare]
M [f] moved to archive [file only]
P print the file to standard output
R fixes compressed files
Rc rebuild the lost volumes
Rn renames files in a compressed archive
Rr [N] adds data recovery record
Rv [N] creates the recovery volume
Conversion between s[name|-] archive and SFX(self-extracting document)
T test archive files
U updates files in compressed files
V [t,b] lists the details of compressed files [technical,bare]
X is unzipped to the full path

< option >
- stop scanning options
AD appends the file name to the target path
Ag [format] generates a compressed file name using the current data
Ap  sets the path inside the file</path>
As synchronization files within the directory
Av setup authentication detection (only registered version provides this feature)
Av - turns off authentication detection
C - close remarks display
CFG - turns off the read setting
The cl conversion name is lowercase
The cu conversion name is uppercase
Delete the original file after df compression
Dh opens the Shared file
Ds turns off name sorting for the stable file
Dw erases files after compression
E [+]<attr> sets the file to exclude and contain properties</attr>
Ed does not add an empty directory
En does not set the file end block
There is no path in the ep name
The ep1 name does not contain the base file directory
Ep3 expands the path to the fully contained drive name
F refresh file
HP [password] encrypts file data and file headers
Id [c,d,p,q] closes the message
Ierr sends all messages to the standard error output
Ilog [name] logs errors to a file (only the registered version provides this)
Inul closes all messages
Isnd turns on the sound
K lock compressed files
KB keeps corrupted files unzipped
M < 0.. 5> sets the compression level (0- store... 3 - the default... 5 - the largest)
MC  sets advanced compression parameters</par>
Md < size > Dictionary size in KB (64128256512102, 4204, 8409 (6) or A - G)
Ms [ext;ext] stores the specified file type
N <file> contains only the specified file</file>
N @ reads the file name from the standard input into the containing content
N @<list> contains the file in the specified list file</list>
O [+|-] sets override mode
Ol saves symbolic links for files as connections
Or automatically renames files
Ow saves the owner and group of live storage files
P [password] set the password
P - does not ask for a password
R performs recursive operations on subdirectories
R0 only recursively operates on subdirectories with wildcard names
Rr [N] adds data recovery record
Rv [N] creates a restore
S [<n>,v[-],e] creates stable file compression</n>
S - turn off stable file compression
Sc < CHR >[obj] sets the specified string
SFX [name] creates SFX files
Si [name] reads data from standard input
Sl <size> handles files that are smaller than the specified value</size>
Sm <size> handles files that are larger than the specified value</size>
T compressed test file
Ta <date> processes the modified date as a file after the specified date, <date> format: YYYYMMDDHHMMSS</date></date>
TB <date> processes the modified date as a file before the specified date, <date> format: YYYYMMDDHHMMSS</date></date>
Tk keeps the file for the original time
Tl sets the file time to the latest file time
Tn <time> processes new files than specified time</time>
To <time> processes files older than the specified time</time>
Ts <m,c,a>[N] save or store file time (modify, create, access)</m,c,a>
U update file
V creates automatically sized volumes or lists all volumes
V <size>[k,b] create volume size of specified size=<size>*1000 [*1024, *1]</size></size>
Ver [n] file version control
Vn USES the old volume naming system
Vp pauses before each volume
W  specifies the working directory</path>
X <file> excludes the specified file</file>
x@ excludes file names that are read from standard input
X @<list> specifies the file to be excluded from the specified list file</list>
Y sets all answers to yes
Z reads the notes of the compressed file from the file 

 

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.