1、安装rar和unrar工具 centos或是redhat可以用yum 

安装命令:

sudo apt-get update                   

sudo apt-get install rar unrar

2、unrar的命令格式如下,

unrar <command> [-<switch 1> -<switch N>] archive [files...] [path...]
下面是man手册里面的内容
   e      Extract files to current directory. 解压中当前文件夹
   l      List archive content.          列出文件
   p      Print file to stdout.                     
   t      Test archive files.           测试文件
   v      Verbosely list archive.
   x      Extract files with full path.   解压文件到文件夹中   

   我们解压时可以用 e或者x这两个command,
   unrar e file
   unrar x file

例如:unrar  e  test.rar  temp/    # temp/ 表示解压的路径