Centos安装Unrar以及使用方法

首先到Unrar网站上下载Linux版本:

http://www.rarsoft.com/download.htm

然后解压安装:

[root@localhost 下载]# ls #查看已下载的rar安装包
rarlinux-32bit-4.2.0.tar.gz  rarlinux-x64-4.2.0.tar.gz
[root@localhost 下载]# tar -zxvf rarlinux-x64-4.2.0.tar.gz #解压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 下载]# cd rar #进入目录安装
[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
[root@localhost 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
[root@localhost rar]# rar #出现如下信息表示rar已安装成功

RAR 4.20   Copyright (c) 1993-2012 Alexander Roshal   9 Jun 2012
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
  cf            Add files comment
  ch            Change archive 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
  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

<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
...
[root@localhost rar]#


基本unrar用法: 

unrar x -o- -y  CTOHome.com.rar   /home/www.CTOHome.com/  (把CTOHome.com.rar文件,解压到/home/www.CTOHome.com目录。要注意解压目录必须以 / 结束)

unrar分卷解压: 假设第一个分卷的文件名CTOHome.r00,所有分卷都在同一个目录。
那么就直接 unrar  x -o- -y CTOHome.r00      /home/www.CTOHome.com/


你可能感兴趣的:(linux)