当前位置: 首页 > 编程日记 > 正文

如何在linux下解压缩rar格式的文件压缩包

前言:没有特殊原因,文档如果要传到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

相关文章:

appium+python自动化45-夜神模拟器连不上(adb server version (36) doesn't match this client (39); killing...)...

前言 最新下了个最新版的夜神模拟器&#xff0c;然后adb devices发现连不上模拟器了&#xff0c;报adb server version (36) doesnt match this client (39); killing... 从报错信息看是adb版本不匹配导致的&#xff0c;接下来讲如何解决这个问题 环境&#xff1a; 夜神模拟器 …

Android.mk文件语法规范

序言&#xff1a; ------------- 此文档旨在描述Android.mk文件的语法&#xff0c;Android.mk文件为Android NDK(原生开发&#xff09;描述了你C/C源文件。为了明白下面的内容&#xff0c;你必须已经阅读了docs/OVERVIEW.TXT的内容&#xff0c;它解释了Android.mk文件扮演的角色…

【硬件基础】制作直流电源

要求&#xff08;其实就是个课设&#xff09;&#xff1a; 利用二极管的基本特性、三极管的基本特性、稳压电源等知识&#xff0c;设计相 应的模拟电路&#xff0c;设计制作放大倍数可变的直流放大器。 任务要求&#xff1a; &#xff08;1&#xff09;用集成芯片制作一个 0~1…

RanceQuest2_从委托到Lambda_会用(递归数学函数)

二连发 使用Lambda表达式编写递归函数 ——摘自老赵点滴 - 追求编程之美。 todo用手敲30遍&#xff0c;搞定——泛型委托&#xff0c;Lambda表达式&#xff0c;简单的数学递归。 遗憾的是&#xff0c;原本希望更进一步做出一个通用的递归方法表达式出来&#xff0c;受所学所限&…

[转载].sscanf的用法

原作者不详。 名称: sscanf() - 从一个字符串中读进与指定格式相符的数据. 函数原型: Int sscanf( string str, string fmt, mixed var1, mixed var2 ... ); int scanf( const char *format [,argument]... ); 说明&#xff1a; sscanf与scanf类似&#xff0c;都是用于输入的&a…

As与强制类型转换的区别以及Is运算符的使用

前言&#xff1a; 开发人员经常需要将一个对象从一个类型转换成其他类型。 在c#中&#xff0c;类型转换按照转换方式分类分为了隐式转换和显式转换&#xff0c;按对象分类又分为了值类型转换和引用类型转换  CLR(参考&#xff1a;http://baike.baidu.com/view/605055.htm)允许…

SQL命令执行数据库备份

backup database XXXXX to diskD:\Bak\BACKUP.bak with init XXXXX是数据库名字转载于:https://www.cnblogs.com/lx0831/archive/2009/04/07/1431115.html

【硬件基础】振荡(时钟)周期、状态周期、机械周期、指令周期

前言&#xff1a; 尽管关于单片机的各种周期在网上随便一查就能查到&#xff0c;但于博主个人而言容易搞混&#xff0c;于复习定时器时决定写下这篇博客&#xff0c;相当于一次知识复习总结 振荡&#xff08;时钟&#xff09;周期&#xff1a; 以12M的单片机为例&#xff0c;其…

14条改善jquery代码的建议

2019独角兽企业重金招聘Python工程师标准>>> 从国外网站找到的。 http://www.tripwiremagazine.com/ajax/developer-toolbox/more-jquery-and-general-javascript-tips-to-improve-your-code.html 很有用。 转载于:https://my.oschina.net/dlpinghailinfeng/blog/26…

HDFS配额查询

### 查看目录配额 hdfs dfs -count -q -h /user/hive/warehouse/db_name.db ### 查看整个HDFS的空间大小 hdfs dfs -df -h /user/ Filesystem Size Used Available Use% hdfs://hdfs01 10 P 8 P 2 P 80%### 查看指定目录/数据库的大小 hdfs …

# 命令行新建 job 错误: ORA-01008 并非所有变量都已绑定 。

# 命令行新建 job 错误: ORA-01008 并非所有变量都已绑定 。 1、改正前代码: DECLARE job NUMBER; begin sys.dbms_job.submit(job > :job, what > P_AUTO_FETCH_RECORDS;, next_date > to_date(10-05-2011 15:58:35, dd-mm-yyyy hh24:mi:ss), interval > s…

【单片机】以输出方波为例的 定时器使用

实验要求&#xff1a; 利用Proteus软件画出电路图&#xff0c;单片机定时器/计数器以查询方式工作&#xff0c;在P1.0口产生周期为100us的连续方波&#xff0c;在P1.0口线上接上示波器观察波形。 前言&#xff1a;写这篇博客的意义在于&#xff0c;借助本实验可以复习定时器中断…

经典GNA整理

最近学习了各种GAN的结构。在此记录下。 转载于:https://www.cnblogs.com/yeran/p/11251842.html

Global.asax

GlobalFilterCollectionRepresents a classthat contains all the globalfilters.HandleErrorAttributemvc中提供了HandleErrorAttribute特性&#xff0c;该特性用于处理由操作方法引发的异常AreaRegistration.RegisterAllAreas();注册 ASP.NET MVC 应用程序中的所有区域RouteC…

leetcode_1. Two Sum

leetcode_1. Two Sum 前言&#xff1a; 这段时间开始敲leetcode。我认为这并不仅仅只是为了应付笔试&#xff0c;面试。而是确实有着一定的意义。 尤其&#xff0c;你提交代码后&#xff0c;网站会多方面验证你的答案。 另外&#xff0c;提交成功后&#xff0c;你可以查看自己的…

linux ngxtop安装安装及使用

写在前面&#xff1a; ngxtop是Nginx日志实时分析利器 1.下载 下载地址&#xff1a;https://github.com/lebinh/ngxtop 下载zip文件到本地 登录linux服务器&#xff0c;定位到安装目录&#xff0c;执行 rz&#xff0c;选中上一步下载的zip文件&#xff0c;上传完成后执行unzip…

POJ1088(滑雪)

题目链接 动态规划题。 题目大意&#xff1a;给定一个二维数组&#xff0c;数组中每个数代表一个高度&#xff0c;每次只能向相邻且高度下降的方向移动&#xff0c;求最长的移动距离。 View Code 1 #include <stdio.h>2 #include <memory.h>3 #define MAX(a,b) ((…

【硬件基础】个人感悟+C语言 引入头文件时引号括号的区别

前言&#xff1a; 惊&#xff01;一博主又在水博客 其实不然&#xff0c;单片机从大一下半年就已经开始自学&#xff0c;但是可能是由于高中养成的惰性思维&#xff0c;不愿意思考&#xff0c;只想靠时间来获得内心的满足感&#xff1a;看我今天又学了一天。其实&#xff0c;假…

走在网页游戏开发的路上(八)

游戏中定时器的设计 0. 前言 在游戏开发中计时器/定时器是必须的&#xff0c;而且会在多处用到&#xff0c;如吃药补血每秒回10点且持续1分钟、玩家从一点到达另一点的过程需要多少时间。下面是定时器在七雄争霸中的几个应用场景&#xff0c;直接上图&#xff1a; 场景1&#…

[epoll]epoll理解

转自&#xff1a;http://blog.51cto.com/yaocoder/888374 1. 流 首先我们来定义流的概念&#xff0c;一个流可以是文件&#xff0c;socket&#xff0c;pipe等等&#xff0c;可以进行I/O操作的内核对象&#xff0c;不管是文件&#xff0c;还是套接字&#xff0c;还是管道&#x…

[kuangbin带你飞]专题五 并查集 E - 食物链 (带权并查集)

E - 食物链 题目链接&#xff1a;https://vjudge.net/contest/66964#problem/E 动物王国中有三类动物A,B,C&#xff0c;这三类动物的食物链构成了有趣的环形。A吃B&#xff0c; B吃C&#xff0c;C吃A。 现有N个动物&#xff0c;以1&#xff0d;N编号。每个动物都是A,B,C中的一种…

关于内网linux系统如果安装nodejs,npm,express,mongodb,forever等

内网的linux系统要安装nodejs以及express等系列的框架&#xff0c;因为系统是局域网和互联网是物理隔离的&#xff0c;所以&#xff0c;没法像官网的安装教程那样直接install了&#xff0c;只能手动安装&#xff0c;这里已经我们自己的linux 系统suse10 为例&#xff1a; 1 No…

【基础知识】如何在word中粘贴出漂亮整洁的代码

使用工具&#xff1a; notepad、WPS 操作实现&#xff1a; 1、右击代码文件使用NPP打开文件 2、选中要复制的代码 3、如图所示&#xff0c;依次点击如下内容 4、直接粘贴到word中&#xff0c;如图

浅析SQL Server数据修复命令DBCC的使用

SQL Server数据库提供了修复命令DBCC&#xff0c;当SQL Server数据库遭到质疑或者是有的无法完成读取时可以尝试用此命令来修复。以下是一些常见的DBCC修复命令&#xff0c;希望会给读者带来帮助。 1. DBCC CHECKDB 重启服务器后&#xff0c;在没有进行任何操作的情况下&#x…

Python之Mysql及SQLAlchemy操作总结

一、Mysql命令总结 1.创建库 create database test1; 2.授权一个用户 grant all privileges on *.* to feng% identified by 1qazWSX; 3.创建表 create table Teacher(teaId int not null, teaname varchar(100), age int, sex enum(M, F), phone int); 4.查询 select * from t…

NSwagStudio for Swagger Api

本案例主要说明如何使用NSwag 工具使用桌面工具快速生成c# 客户端代码、快速的访问Web Api。 NSwagStudio 下载地址 比较强大、可以生成TypeScript、WebApi Controller、CSharp Client 1、运行WebApi项目 URL http://yourserver/swagger 然后你将看到界面如下 1.1 Web API 代…

【html】如何解决标签设置成超链接后字体格式及颜色变化的问题

问题描述&#xff1a; 如图所示&#xff0c;将一个标签设置成超链接后字体颜色和格式会发生改变&#xff0c;如果我只想让它保持原来的格式应该怎么办&#xff1f; 解决方法&#xff1a; 在a标签中添加一个属性&#xff1a; style"color:inherit;" 添加后的代码&…

js判断 IE 浏览器

1 $.browser.msie && ($.browser.version 6.0) 转载于:https://www.cnblogs.com/zhupinglei/archive/2012/04/28/2475186.html

UNIX编程笔记:关于停止的进程接收信号的问题

为什么80%的码农都做不了架构师&#xff1f;>>> 因为资料缺少&#xff0c;按照测试得出来&#xff0c;停止状态的进程貌似只对SIGCONT有反应&#xff0c;而别的默认就是忽略。 转载于:https://my.oschina.net/kut/blog/27736

脱壳 VMProtect 1.70.4

【文章标题】: 脱壳 VMProtect 1.70.4 【文章作者】: hxqlky【作者邮箱】: zmunlkygmail.com【作者主页】: http://www.x5dj.com/hxqlky【下载地址】: 自己搜索下载【加壳方式】: VMProtect 1.70.4【保护方式】: VMProtect 1.70.4【编写语言】: MASM32 / TASM32 【使用工具】:…