CentOS installation rar and usage

Source: Internet
Author: User
Tags rar



The installation steps are as follows:
1. Download RAR installation package
: http://www.rarsoft.com/download.htm, according to the operating system select the corresponding binary installation package, my CentOS operating system is 64bit, so download rar for rarlinux-x64-5.4.b2.tar.gz.

2. Installation rar





[[email protected]ocalhost Downloads]# tar -zxvf rarlinux-x64-5.4.b2.tar.gz 
rar/
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
[[email protected] Downloads]# cd rar
[[email protected] rar]# ls
acknow.txt   license.txt  order.htm  rarfiles.lst  rar.txt     unrar
default.sfx  makefile     rar        rar_static    readme.txt  whatsnew.txt
[[email protected] rar]# make
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
[[email protected] rar]# rar

RAR 5.40 beta 2   Copyright (c) 1993-2016 Alexander Roshal   30 May 2016
Trial version             Type RAR -? for help

Usage:     rar <command> -<switch 1> -<switch N> <archive> <files...>
               <@listfiles...> <path_to_extract\>

<Commands>
  a             Add files to archive
  c             Add archive comment
  ch            Change archive parameters
  cw            Write archive comment to file
  d             Delete files from archive
  e             Extract files without archived paths
  f             Freshen files in archive
  i[par]=<str>  Find string in archives
  k             Lock archive
  l[t[a],b]     List archive contents [technical[all], 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
  rv[N]         Create recovery volumes
  s[name|-]     Convert archive to or from SFX
  t             Test archive files
  u             Update files in archive
  v[t[a],b]     Verbosely list archive contents [technical[all],bare]
  x             Extract files with full path

<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 file attributes
  ap<path>      Set path inside archive
  as            Synchronize archive contents
  c-            Disable comments show
  cfg-          Disable read configuration
  cl            Convert names to lower case
  cu            Convert names to upper case
  df            Delete files after archiving
  dh            Open shared files
  ds            Disable name sort for solid archive
  dw            Wipe files after archiving
  e[+]<attr>    Set file exclude and include attributes
  ed            Do not add empty directories
  en            Do not put ‘end of archive‘ block
  ep            Exclude paths from names
  ep1           Exclude base directory from names
  ep3           Expand paths to full including the drive letter
  f             Freshen files
  hp[password]  Encrypt both file data and headers
  ht[b|c]       Select hash type [BLAKE2,CRC32] for file checksum
  id[c,d,p,q]   Disable messages
  ierr          Send all messages to stderr
  ilog[name]    Log errors to file (registered versions only)
  inul          Disable all messages
  isnd          Enable sound
  iver          Display the version number
  k             Lock archive
  kb            Keep broken extracted files
  log[f][=name] Write names to log file
  m<0..5>       Set compression level (0-store...3-default...5-maximal)
  ma[4|5]       Specify a version of archiving format
  mc<par>       Set advanced compression parameters
  md<n>[k,m,g]  Dictionary size in KB, MB or GB
  ms[ext;ext]   Specify file types to store
  mt<threads>   Set the number of threads
  n<file>       Additionally filter included files
  [email protected]            Read additional filter masks from stdin
  [email protected]<list>      Read additional filter masks from list file
  o[+|-]        Set the overwrite mode
  oh            Save hard links as the link instead of the file
  oi[0-4][:min] Save identical files as references
  ol[a]         Process symbolic links as the link [absolute paths]
  or            Rename files automatically
  ow            Save or restore file owner and group
  p[password]   Set password
  p-            Do not query password
  qo[-|+]       Add quick open information [none|force]
  r             Recurse subdirectories
  r-            Disable recursion
  r0            Recurse subdirectories for wildcard names only
  rr[N]         Add data recovery record
  rv[N]         Create recovery volumes
  s[<N>,v[-],e] Create solid archive
  s-            Disable solid archiving
  sc<chr>[obj]  Specify the character set
  sfx[name]     Create SFX archive
  si[name]      Read data from standard input (stdin)
  sl<size>      Process files with size less than specified
  sm<size>      Process files with size more than specified
  t             Test files after archiving
  ta<date>      Process files modified after <date> in YYYYMMDDHHMMSS format
  tb<date>      Process files modified before <date> in YYYYMMDDHHMMSS format
  tk            Keep original archive time
  tl            Set archive time to latest file
  tn<time>      Process files newer than <time>
  to<time>      Process files older than <time>
  ts<m,c,a>[N]  Save or restore file time (modification, creation, access)
  u             Update files
  v<size>[k,b]  Create volumes with size=<size>*1000 [*1024, *1]
  ver[n]        File version control
  vn            Use the old style volume naming scheme
  vp            Pause before each volume
  w<path>       Assign work directory
  x<file>       Exclude specified file
  [email protected]            Read file names to exclude from stdin
  [email protected]<list>      Exclude files listed in specified list file
  y             Assume Yes on all queries
  z[file]       Read archive comment from file





3. rar command Usage
Example 1: Add a file or directory to a compressed archive, using the a command.
For example, add the file files1 to Abc.rar, use the A or M command, a command to add the File1 file to the Abc.rar file to keep the original file1 files unchanged, M command to move the file1 file into the File1.rar files ( When the compression is complete, the original file1 file is deleted, note: The M command is only for the file operation)


[email protected] ~]# rar a abc.rar file1
Note: If the Abc.rar file does not exist at this time, the Abc.rar file will be created on its own; if the Abc.rar files already exist, the file1 files will be compressed into the Abc.rar files, and if a Abc.rar file already exists in the file1 files, the File1 file will be updated. And the original File1 file still exists in the current directory, to move the file1 file to File1.rar, use the M command, which is also available for the directory.
Note: If you enter only the "rar a File1.rar" command instead of the file name or directory name, all the files and folders in the current directory will be compressed into the File1.rar document. Pay attention to this point.
Example 2: Extract the contents of the Abc.rar file, you can use the E or X command, assuming that the Abc.rar directory has a file named File1 and a directory named Test, the test directory has a file named File2,
[email protected] ~]# rar e abc.rar  #不推荐
Note: Using the e command, the File1 file in Abc.rar is extracted to the current directory along with the File2 file in the test directory. If you want to keep the directory structure in the Abc.rar directory, use the x command.
[email protected] ~]# rar x abc.rar #推荐
Description: The File1 file and the test directory are extracted to the current folder.

Example 3: Add comments for the entire compressed file
[[email protected] ~]# rar c Abc.rar
Note: When you enter this command, the bottom of the screen is displayed
Processing archive test.rarreading comment from stdin
And there is a cursor blinking, enter the comment information from the position where the cursor blinks, enter the end input by pressing CTRL+D

Example 4: Write a note of the entire file to a file, using the CW command. Join to write comments for Abc.rar to the Test.txt file
[[email protected] ~]# rar CW Abc.rar test.txt
Note: If a file named Test.txt is not present in the current directory, a file named Test.txt will be created on its own, and Abc.rar's comments will be written to the Text.txt file. If a file named Text.txt already exists in the current directory, you are prompted to overwrite the file that already exists, and if you select Yes or all, the contents of the test.txt are emptied, and the Abc.rar comment content is written to the Text.txt file.

Example 5: Deleting a file or directory in a compressed archive, using the D command. For example, to delete the File1 file in the Abc.rar archive.
[[email protected] ~]# rar d abc.rar file1
Note: This command removes the File1 file from the Abc.rar archive and is also valid for the directory.

Unzip the command Unrar using:
[Email protected] ~]# Unrar--help
Usage:







Unrar <command>-<switch 1>-<switch n> <archive> <files...>           < @listfiles ...> <path_to_extract\>
< commands >
e Extract the files to the current directory
l [t, b] List compressed file information [technical, bare]
p print file to standard output
t test compression i russian
v [t, b] lists detailed information for compressed documents
Unrar commands and RAR have the same effect, you can see that Unrar contains only a part of the RAR command, so the use of RAR can do all the operation.





The parameters are as follows:
< commands >





a Add files to compressed archive
  c Add a compressed archive comment (the size of the comment cannot exceed 62000 bytes)
  cf add file comments (display file comments when using the ‘v’ parameter, the maximum cannot exceed 32767 bytes)
  ch change archive parameters
  cw write file comments to the specified file
  d delete files from archive
  e Extract the files to the current directory (do not create any subdirectories)
  f Refresh the files in the archive (update these files after they are packaged, do not add new ones to the compressed archive)
  i [par] = <str> find specific characters in the archive
  k lock file (any command that attempts to change the contents of a compressed file is ignored)
  l [t, b] list files [technical, bare]
  m [f] Move to compressed file [for files only]
  p print file to standard output
  r patch archive
  rc rebuilds lost volumes
  rn Rename files in compressed archives
  rr [N] Add data recovery record
  rv [N] creates a recovery volume
  s [name |-] Conversion between compressed archives and SFX (self-extracting files)
  t test compressed archive
  u Update files in compressed archives
  v [t, b] List detailed information for compressed files [technical, bare]
  x decompress to full path

<Option>
  -Stop scanning of options
  ad Append file name to target path
  ag [format] Generate compressed file name using current data
  ap <path> set the path inside the archive
  as Synchronize the directory in the file
  av Set authentication detection (only registered version provides this function)
  av- Turn off authentication detection
  c- Turn off note display
  cfg- Turn off read settings
  cl convert name to lowercase
  cu convert name to uppercase
  Delete original files after df compression
  dh open shared file
  ds turn off name sorting for solid files
  dw erase files after compression
  e [+] <attr> Set file exclusion and include attributes
  ed does not add empty directories
  en do not set end of file block
  No path in ep name
  ep1 name does not include the base file directory
  ep3 expand path to fully included drive name
  f refresh file
  hp [password] encrypt file data and file headers
  id [c, d, p, q] close the message
  ierr sends all messages to standard error output
  ilog [name] records the error log to a file (only the registered version provides this function)
  inul close all messages
  isnd open sound
  k Lock archive
  kb keep uncompressed corrupted files
  m <0..5> set compression level (0-storage ... 3-default ... 5-maximum)
  mc <par> Set advanced compression parameters
  md <size> Dictionary size in KB (64,128,256,512,1024,2048,4096 or A-G)
  ms [ext; ext] stores the specified file type
  n <file> contains only the specified files
  [email protected] Read filename from stdin to include
  [email protected] <list> Include files in the specified list file
  o [+ |-] Set overwrite mode
  ol save symbolic link for file as link
  or automatically rename file
  ow Save owner and group of live storage files
  p [password] set password
  p- don't ask for password
  r recursive operation on subdirectories
  r0 recursive subdirectories with wildcard names only
  rr [N] Add data recovery record
  rv [N] create recovery
  s [<N>, v [-], e] creates robust archive compression
  s- Turn off solid file compression
  sc <chr> [obj] Sets the specified string
  sfx [name] Create SFX File
  si [name] reads data from standard input
  sl <size> Process file size is smaller than the specified value
  sm <size> Processes a file larger than the specified value
  t Test file after compression
  ta <date> Process files whose modification date is after the specified date, <date> format: YYYYMMDDHHMMSS
  tb <date> Process files whose modification date is before the specified date, <date> format: YYYYMMDDHHMMSS
  tk keep the file for the first time
  tl set 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] save or store file time (modify, create, access)
  u update file
  v Create automatic-size volumes or list all volumes
  v <size> [k, b] Create a volume of the specified size size = <size> * 1000 [* 1024, * 1]
  ver [n] File version control
  vn uses the old volume naming system
  vp pause before each volume
  w <path> specifies the working directory
  x <file> exclude specified files
  [email protected] Exclude file names read from standard input
  [email protected] <list> Specify files to exclude from the specified list file
  y set all answers to yes
  z [file] read comments from compressed file 





For more discussion and exchange on Linux/unix, please follow our blog and Sina Weibo Songzi_tea.


CentOS installation rar and usage


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.