前言:没有特殊原因,文档如果要传到linux上,一定要打成*.zip格式,
这样方便解压,一般来说没有理由要用rar.关于 linux上unzip命令有空细讲,
本节讲下,如何让linux支持解压缩rar文件

一 、系统环境

1.1 系统环境
实验环境一:
CentOS release 5.5 (Final)
2.6.18-194.el5
x86_64 GNU/Linux <--64位系统
实验环境二:
CentOS release 5.4 (Final)
2.6.18-164.el5
i686 GNU/Linux <--32位系统

1.2命令查看方法:
[root@oldboy tools]# cat /etc/redhat-release
CentOS release 5.5 (Final)
[root@oldboy tools]# uname -r
2.6.18-194.el5
[root@oldboy tools]# uname -m
x86_64

二、下载并安装rar软件

2.1 下载
mkdir -p  /home/oldboy/tools
cd /home/oldboy/tools
wget http://files.keray.com/winrar/rarlinux-3.8.0.tar.gz

2.2 安装
tar zxvf rarlinux-3.8.0.tar.gz
cd rar
make
make install

三、rar命令语法

将/etc 目录压缩为etc.rar 命令为:

rar a etc.rar /etc

将etc.rar 解压 命令为:
rar x etc.rar
unrar -e etc.tar

四、具体例子

实例:将/etc 目录压缩为etc.rar

[root@oldboy tools]# rar a etc.rar /etc

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Evaluation copy. Please register.

Creating archive etc.rar

Adding    /etc/gdm/securitytokens.conf                                OK
Adding    /etc/gdm/Init/Default                                       OK
Adding    /etc/gdm/custom.conf                                        OK
Adding    /etc/gdm/Xsession                                           OK
Adding    /etc/gdm/PostSession/Default                                OK
Adding    /etc/gdm/PreSession/Default                                 OK
Adding    /etc/gdm/XKeepsCrashing                                     OK
Adding    /etc/gdm/locale.alias                                       OK
Adding    /etc/gdm/PostLogin/Default.sample                           OK
省略若干行......

查看
[root@oldboy tools]# ll
总计 26704
-rw-r--r-- 1 root root 26505645 08-20 20:26 etc.rar

将etc.rar 解压:
[root@oldboy tools]# rar x etc.rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware version         Type RAR -? for help

Extracting from etc.rar

Creating    etc                                                       OK
Creating    etc/gdm                                                   OK
Extracting  etc/gdm/securitytokens.conf                               OK
Creating    etc/gdm/Init                                              OK
Extracting  etc/gdm/Init/Default                                      OK
Extracting  etc/gdm/custom.conf                                       OK
Extracting  etc/gdm/Xsession                                          OK
Creating    etc/gdm/PostSession                                       OK
Extracting  etc/gdm/PostSession/Default                               OK
省略若干行......

五、更多命令 查看帮助

[root@oldboy rar]# rar

RAR 3.80   Copyright (c) 1993-2008 Alexander Roshal   16 Sep 2008
Shareware 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
  ad            Append archive name to destination path
  ag[format]    Generate archive name using the current date
  ap<path>      Set path inside archive
  as            Synchronize archive contents
  av            Put authenticity verification (registered versions only)
  av-           Disable authenticity verification check
  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
  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
  k             Lock archive
  kb            Keep broken extracted files
  m<0..5>       Set compression level (0-store...3-default...5-maximal)
  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]   Specify file types to store
  n<file>       Include only specified file
  n@            Read file names to include from stdin
  n@<list>      Include files in specified list file
  o[+|-]        Set the overwrite mode
  ol            Save symbolic links as the link instead of the file
  or            Rename files automatically
  ow            Save or restore file owner and group
  p[password]   Set password
  p-            Do not query password
  r             Recurse subdirectories
  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             Create volumes with size autodetection or list all volumes
  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
  x@            Read file names to exclude from stdin
  x@<list>      Exclude files in specified list file
  y             Assume Yes on all queries
  z[file]       Read archive comment from file

[root@ha-1-1 rar]# unrar

UNRAR 3.80 freeware      Copyright (c) 1993-2008 Alexander Roshal

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

<Commands>
  e             Extract files to current directory
  l[t,b]        List archive [technical, bare]
  p             Print file to stdout
  t             Test archive files
  v[t,b]        Verbosely list archive [technical,bare]
  x             Extract files with full path

<Switches>
  -             Stop switches scanning
  ad            Append archive name to destination path
  ap<path>      Set path inside archive
  av-           Disable authenticity verification check
  c-            Disable comments show
  cfg-          Disable read configuration
  cl            Convert names to lower case
  cu            Convert names to upper case
  dh            Open shared files
  ep            Exclude paths from names
  ep3           Expand paths to full including the drive letter
  f             Freshen files
  id[c,d,p,q]   Disable messages
  ierr          Send all messages to stderr
  inul          Disable all messages
  kb            Keep broken extracted files
  n<file>       Include only specified file
  n@            Read file names to include from stdin
  n@<list>      Include files in specified list file
  o[+|-]        Set the overwrite mode
  or            Rename files automatically
  ow            Save or restore file owner and group
  p[password]   Set password
  p-            Do not query password
  r             Recurse subdirectories
  sl<size>      Process files with size less than specified
  sm<size>      Process files with size more than specified
  ta<date>      Process files modified after <date> in YYYYMMDDHHMMSS format
  tb<date>      Process files modified before <date> in YYYYMMDDHHMMSS format
  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             List all volumes
  ver[n]        File version control
  vp            Pause before each volume
  x<file>       Exclude specified file
  x@            Read file names to exclude from stdin
  x@<list>      Exclude files in specified list file
  y             Assume Yes on all queries

更多 技术 见http://www.etiantian.org

本文出自 “老男孩的linux博客” 博客,请务必保留此出处http://oldboy.blog.51cto.com/2561410/597515

如何在linux下解压缩rar格式的文件压缩包相关推荐

  1. linux rar加压_如何在linux下解压缩rar格式的文件压缩包

    ######################################################### #老男孩笔记系列-如何在linux下解压缩rar格式的文件压缩包 #date:201 ...

  2. Linux系统rar格式怎么解压,如何在linux下解压缩rar格式的文件压缩包

    这样方便解压,一般来说没有理由要用rar.关于 linux上unzip命令有空细讲, 本节讲下,如何让linux支持解压缩rar文件 一 .系统环境 1.1 系统环境 实验环境一: CentOS re ...

  3. 如何在linux下解压缩rar和zip格式的文件压缩包

    转载:http://oldboy.blog.51cto.com/2561410/597515 使用apt-get安装:  sudo apt-get install  rar  zip rar使用: 将 ...

  4. Linux下解压rar格式和zip格式文件

    写在前面的话 欢迎扫码关注我的公众号,与我一同进步!主要致力于学习 使用深度学习解决计算机视觉相关问题 Python为主的互联网应用服务 基于MIPS指令集的CPU微体系结构设计 引言 最近在完成深度 ...

  5. linux 解压rar格式的文件怎么打开,linux服务器怎么解压rar格式的文件

    做seo的很多人都会经历过这个问题,那就是安装的宝塔.wdcp等面板后,但是在上传完压缩文件的时候,发现压缩文件是rar后缀的压缩文件,在宝塔面板中就解压不了rar文件. 一.于是就想着把后缀改为zi ...

  6. linux 下解压缩rar文件

    2019独角兽企业重金招聘Python工程师标准>>> 今天下了一个glibc的压缩文件是rar格式,发现linux本身不支持这种压缩格式,这样好多windows上的有用东西就没法看 ...

  7. Linux下解压rar格式文件

    首先:rar文件与zip tar.gz等等开源压缩文件是不一样的,rar类型的压缩协议是不开源的,所以linux系统自身是没有安装rar的解压工具的,所以我们需要自己下载rar工具,注:由于rar类型 ...

  8. linux系统解压缩rar文件夹,linux下解压缩rar文件的办法

    linux下如何解压缩rar文件呢? 请看下面的介绍. 一 .系统环境 1.1 系统环境 实验环境一: CentOS release 5.5 (Final) 2.6.18-194.el5 x86_64 ...

  9. Linux(Centos7)环境下解压rar格式文件

    Centos7环境下解压rar格式文件 1 下载rar软件压缩包 2 解压rar压缩包 3 编译rar 4 安装部分依赖包 5 解压文件.压缩文件 6 rar更多使用方法 1 下载rar软件压缩包 w ...

最新文章

  1. springmvc的配置
  2. python机械手标定_机械手姿态的获取,ros,臂,当前,位姿
  3. python爬虫的scrapy安装+pymongo的安装
  4. elasticsearch 根据条件更新数据
  5. storm 简介及单机版安装指南
  6. Linux环境Elasticsearch6.xxx 之kibana可视化工具操作索引
  7. java oracle的2种分页方法
  8. 记一次在Tomcat部署项目后无法启动该项目的例子
  9. Linux 上的数据可视化工具
  10. 1.4 Linux文件系统与目录结构
  11. jsdroid 教程_教程24富怡服装cad软件V8安装包送操作说明书自学180部视频教程制版排料放码工具操作教学打赏49.8大洋...
  12. 深入浅出python中文版pdf-深入浅出Python 巴里著 中文 PDF版 [37M]
  13. maven命令行打包
  14. python 生意参谋_电商 Python 抓取 生意参谋-访客数据
  15. 飞算(SoFlu)软件机器人——人人都是全栈架构师
  16. 【其他】微信双开、多开的几种方法
  17. 那些年,我们关注过的放大电路设计要点
  18. MySqlDataAdapter.Update -- 报错
  19. pandas 向已有的excel指定的行和列添加数据
  20. 输入一行字符,分别统计出其中英文字母、空格、数字和其它字符的个数

热门文章

  1. php中怎么过滤器_PHP 过滤器(Filter)
  2. 【数据库】 兴唐第二十七节课只sql注入
  3. String创建方式及其区别(快速了解)
  4. python清华大学出版社第三章课堂作业的答案_Python程序设计清华大学出版社董付国第3章选择与循环题库.ppt...
  5. c++ windows获得当前工作目录文件_基于linux下Python文件操作
  6. mysql主从配置读写分离笔记
  7. Nodejs Express dockerfile最佳实践
  8. windows下Bullet 2.82编译安装(Bullet Physics开发环境配置)
  9. 【FE前端学习】第二阶段任务-基础
  10. bzoj1251: 序列终结者 (splay)