首页   >   心得技巧

Linux环境中解压缩rar文件

Linux系统中默认没法解压rar文件,之前碰到过zip文件,可以使用zip和unzip来搞定,虽然也不是默认的,但是安装起来比较方便,直接yum就OK了,今天来看一下如何安装rar解压工具。

下图中看到,有两个rar,但是我一直解压不了,惨的一批:

Linux环境中解压缩rar文件

按照我一贯的作风,是非要去官网下载的,但是这次时间有限,不知道找的这个是不是官网:http://www.rarlab.com/download.htm,转了好半天才出来,就在我准备开VPN的时候,竟然加载完了,据说这个东西好像还不是免费的,也不知道我找的这个能用多久。。。

Linux环境中解压缩rar文件

下载的是一个tart.gz文件,解压之后,里面有两个shell脚本:

Linux环境中解压缩rar文件

直接make:

Linux环境中解压缩rar文件

还以为又是噼里啪啦一堆日志,没想到竟然这么少,而且看日志信息,似乎就是拷贝了两个shell脚本到/usr/local/bin下面。

现在就可以使用unrar命令进行解压了:unrar e <rar文件>

[root@iZbp16sksdu04rk7tj72xdZ 20190425]# unrar e 8b668ce8-7a3c-4fe5-b3e8-6c0797ce7176.rar 

UNRAR 5.71 beta 2 freeware      Copyright (c) 1993-2019 Alexander Roshal


Extracting from 8b668ce8-7a3c-4fe5-b3e8-6c0797ce7176.rar

Extracting  pom.xml                                                   OK 
Extracting  BaseController.java                                       OK 
Extracting  BookController.java                                       OK 
Extracting  SchoolController.java                                     OK 
Extracting  StudentController.java                                    OK 
Extracting  BaseDao.java                                              OK 
Extracting  BookDao.java                                              OK 
Extracting  BookDaoImpl.java                                          OK 
Extracting  SchoolDaoImpl.java                                        OK 
Extracting  StudentDaoImpl.java                                       OK 
Extracting  SchoolDao.java                                            OK 
Extracting  StudentDao.java                                           OK 
Extracting  Book.java                                                 OK 
Extracting  School.java                                               OK 
Extracting  Student.java                                              OK 
Extracting  BookService.java                                          OK 
Extracting  BookServiceImpl.java                                      OK 
Extracting  SchoolServiceImpl.java                                    OK 
Extracting  StudentServiceImpl.java                                   OK 
Extracting  SchoolService.java                                        OK 
Extracting  StudentService.java                                       OK 
Extracting  applicationContext.xml                                    OK 
Extracting  hibernate.cfg.xml                                         OK 
Extracting  Book.hbm.xml                                              OK 
Extracting  School.hbm.xml                                            OK 
Extracting  Student.hbm.xml                                           OK 
Extracting  struts.xml                                                OK 
Extracting  wolff.sql                                                 OK 
Extracting  book_list.jsp                                             OK 
Extracting  book_maintain.jsp                                         OK 
Extracting  index.jsp                                                 OK 
Extracting  jquery-1.9.0.min.js                                       OK 
Extracting  school_list.jsp                                           OK 
Extracting  school_maintain.jsp                                       OK 
Extracting  student_list.jsp                                          OK 
Extracting  student_maintain.jsp                                      OK 
Extracting  web.xml                                                   OK 
All OK
[root@iZbp16sksdu04rk7tj72xdZ 20190425]# 

rar命令相关的用法如下:

UNRAR 5.71 beta 2 freeware      Copyright (c) 1993-2019 Alexander Roshal

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

<Commands>
  e             Extract files without archived paths
  l[t[a],b]     List archive contents [technical[all], bare]
  p             Print file to stdout
  t             Test archive files
  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
  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>       Additionally filter included files
  n@            Read additional filter masks from stdin
  n@<list>      Read additional filter masks from list file
  o[+|-]        Set the overwrite mode
  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
  r             Recurse subdirectories
  sc<chr>[obj]  Specify the character set
  sl<size>      Process files with size less than specified
  sm<size>      Process files with size more than specified
  ta[mcao]<d>   Process files modified after <d> YYYYMMDDHHMMSS date
  tb[mcao]<d>   Process files modified before <d> YYYYMMDDHHMMSS date
  tn[mcao]<t>   Process files newer than <t> time
  to[mcao]<t>   Process files older than <t> time
  ts[m,c,a]     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 listed in specified list file
  y             Assume Yes on all queries

QQ群: 686430774  /  718410762

站长Q: 1347384268

如果文章有帮到你,可以考虑请博主喝杯咖啡!

分享到:

欢迎分享本文,转载请注明出处!

作者:不忘初心

发布时间:2019-04-27

永久地址:https://www.jiweichengzhu.com/article/ab410b339b374065a47013036dffb583

评论