CentOS安装rar及用法

安装步骤如下:
1、下载rar安装包
下载地址:http://www.rarsoft.com/download.htm,根据操作系统选择对应的二进制安装包,我的CentOS操作系统为64bit,因此下载的rar为rarlinux-x64-5.4.b2.tar.gz。

2、安装rar

[root@localhost Downloads]# tar -zxvf rarlinux-x64-5.4.b2.tar.gz 
rar/
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 Downloads]# cd rar
[root@localhost rar]# ls
acknow.txt   license.txt  order.htm  rarfiles.lst  rar.txt     unrar
default.sfx  makefile     rar        rar_static    readme.txt  whatsnew.txt
[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 5.40 beta 2   Copyright (c) 1993-2016 Alexander Roshal   30 May 2016
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
  ch            Change archive parameters
  cw            Write archive comment to file
  d             Delete files from archive
  e             Extract files without archived paths
  f             Freshen files in archive
  i[par]=<str>  Find string in archives
  k             Lock archive
  l[t[a],b]     List archive contents [technical[all],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[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
  as            Synchronize archive contents
  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
  ht[b|c]       Select hash type [BLAKE2,CRC32] for file checksum
  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
  iver          Display the version number
  k             Lock archive
  kb            Keep broken extracted files
  log[f][=name] Write names to log file
  m<0..5>       Set compression level (0-store...3-default...5-maximal)
  ma[4|5]       Specify a version of archiving format
  mc<par>       Set advanced compression parameters
  md<n>[k,m,g]  Dictionary size in KB,MB or GB
  ms[ext;ext]   Specify file types to store
  mt<threads>   Set the number of threads
  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
  oh            Save hard links as the link instead of the file
  oi[0-4][:min] Save identical files as references
  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
  qo[-|+]       Add quick open information [none|force]
  r             Recurse subdirectories
  r-            Disable recursion
  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<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 listed in specified list file
  y             Assume Yes on all queries
  z[file]       Read archive comment from file

3、rar命令用法
例1:添加文件或目录到压缩档案中,使用a命令。
例如把文件files1添加到abc.rar中,使用a或m命令,a命令把file1文件添加到abc.rar档案中保持原有的file1文件不变,m命令移动file1文件到file1.rar档案中(压缩完成后会删除原有的file1文件,注意:m命令只针对文件进行操作)

[root@localhost ~]# rar a abc.rar file1
说明:如果此时abc.rar档案不存在,会自行创建abc.rar文档案;如果abc.rar档案已经存在,则将file1文件压缩进abc.rar档案 中;若abc.rar档案中已存在一个file1文件,则会更新file1文件。并且原有的file1文件依然存在于当前目录下,若要将file1文件移动到file1.rar中请使用m命令,对于目录同样可以进行此操作。
注意:如果只输入"rar a file1.rar"命令,而没有接文件名或目录名的话,会将当前目录下所有的文件和文件夹压缩进file1.rar文档中。这点要注意一下。
例2:解压缩abc.rar档案中的内容,可以使用e或x命令,假设abc.rar目录中有一个名为file1的文件和一个名为test的目录,test目录中有一个名为file2的文件,
[root@localhost ~]# rar e abc.rar  #不推荐
说明:使用e命令,会将abc.rar中的file1文件连同 test目录下的file2文件解压到当前目录。如果想保持abc.rar目录中的目录结构请使用x命令。
[root@localhost ~]# rar x abc.rar #推荐
说明:此时会将file1文件和test目录解压到当前文件夹。

例3:为整个压缩文件添加注释
[root@localhost ~]# rar c abc.rar
说明:输入该命令后,屏幕最下方会显示
Processing archive test.
rarReading comment from stdin
并有一个光标在闪烁,从光标闪烁的位置输入注释信息,输入完了按下Ctrl+D结束输入

例4:把整个档案的注释写入到一个文件中,使用cw命令。加入要将abc.rar的注释写入到test.txt文件中
[root@localhost ~]# rar cw abc.rar test.txt
说 明:如果当前目录下不存在名为test.txt的文件,则会自行创建一个名为 test.txt的文件,并将abc.rar的注释写入到text.txt文 件中,如果当前目录中已经存在一个名为text.txt的文件,则会提示你是否覆盖已经存在的文件,如果选择Yes或者All,则会清空test.txt 中原有的内容,然后将abc.rar的注释内容写入到text.txt文件中。

例5:删除压缩档案中的文件或目录,使用d命令。例如要删除abc.rar档案中的file1文件。
[root@localhost ~]# rar d abc.rar file1
说明:该命令删除abc.rar档案中的file1文件,对于目录同样有效。

解压缩命令unrar的使用:
[root@localhost ~]# unrar --help
用法:
unrar <command> -<switch 1> -<switch N> <archive> <files...>
           <@listfiles...> <path_to_extract\>
<命令>
e             解压文件到当前目录
l[t,b]        列出压缩文档信息[technical,bare]
p             打印文件到标准输出
t             测试压缩我俄当
v[t,b]        列出压缩文档的详细信息[technical,bare]
x             解压文件到完整路径
unrar的命令和rar具有同样的效果,可以看出unrar只包含了rar的一部分命令而已,因此使用rar就可以完成所有操作。

参数如下:
<命令>

  a             添加文件到压缩档案
  c             添加压缩档案注释(注释的大小最大不能超过62000字节)
  cf            添加文件备注( 当使用'v'参数时显示文件备注,最大不能超过32767字节)
  ch            改变压缩档案参数
  cw            向指定文件写入档案备注
  d             从档案中删除文件
  e             解压缩文件到当前目录(不创建任何子目录)
  f             刷新档案中的文件(更新这些文件自它们被打包之后产生的变化,不在压缩档案中增加新的)
  i[par]=<str>  在档案中查找特定字符
  k             锁定档案(任何试图改变压缩档案中内容的命令都会被忽略)
  l[t,b]        列出档案[technical,bare]
  m[f]          移动到压缩档案中[只针对文件]
  p             打印文件到标准输出
  r             修补压缩档案
  rc            重建丢失的分卷
  rn            重命名压缩档案中的文件
  rr[N]         添加数据恢复记录
  rv[N]         创建恢复卷
  s[name|-]     压缩档案与SFX(自解压文档)之间的转换
  t             测试压缩档案文件
  u             更新压缩档案中的文件
  v[t,b]        列出压缩档案的详细信息[technical,bare]
  x             解压缩到完整路径

<选项>
  -             停止对选项的扫描
  ad            追加档案名称到目标路径
  ag[format]    使用当前数据生成压缩档案名
  ap<path>      在档案内部设置路径
  as            同步档案内目录
  av            设置认证检测(只有注册版提供此功能)
  av-           关闭认证检测
  c-            关闭备注显示
  cfg-          关闭读取设置
  cl            转换名称为小写字母
  cu            转换名称为大写字母
  df            压缩后删除原文件
  dh            打开共享文件
  ds            关闭针对于稳固档案的名称排序
  dw            压缩后擦除文件
  e[+]<attr>    设置文件排除与包含属性
  ed            不添加空目录
  en            不设置档案结束块
  ep            名称中不包含路径
  ep1           名称中不包含基本文件目录
  ep3           展开路径到完整包含的驱动器名
  f             刷新文件
  hp[password]  加密文件数据和文件头部
  id[c,q]   关闭消息
  ierr          发送所有消息到标准错误输出
  ilog[name]    记录错误日志到文件中(只有注册版提供此功能)
  inul          关闭所有消息
  isnd          打开声音
  k             锁定压缩档案
  kb            保持被解压过的已损坏的文件
  m<0..5>       设置压缩等级(0-存储...3-默认...5-最大)
  mc<par>       设置高级压缩参数
  md<size>      Dictionary size in KB (64,128,256,512,1024,2048,4096 or A-G)
  ms[ext;ext]   存储指定的文件类型
  n<file>       仅包含指定的文件
  n@            从标准输入读取文件名到包含内容中
  n@<list>      在指定列表文件中包含文件
  o[+|-]        设置重写模式
  ol            替文件保存符号连接作为连接
  or            自动重命名文件
  ow            保存活存储文件的拥有者与群组
  p[password]   设置密码
  p-            不询问密码
  r             对子目录进行递归操作
  r0            仅用通配符名称对子目录进行递归操作
  rr[N]         添加数据恢复记录
  rv[N]         创建恢复
  s[<N>,e] 创建稳固档案压缩
  s-            关闭稳固档案压缩
  sc<chr>[obj]  设置指定的字符串
  sfx[name]     创建SFX档案
  si[name]      从标准输入读取数据
  sl<size>      处理文件的大小小于指定的值
  sm<size>      处理文件的大小大于指定的值
  t             压缩后测试文件
  ta<date>      处理修改日期为指定日期之后的文件,<date>格式: YYYYMMDDHHMMSS
  tb<date>      处理修改日期为指定日期之前的文件,<date>格式: YYYYMMDDHHMMSS
  tk            保持档案最初的时间
  tl            设置档案时间为据现在最近的文件时间
  tn<time>      处理比指定时间新的文件
  to<time>      处理比指定时间旧的文件
  ts<m,a>[N]  保存或存储文件时间(修改,创建,访问)
  u             更新文件
  v             创建自动大小的卷或列出所有卷
  v<size>[k,b]  创建指定大小的卷size=<size>*1000 [*1024,*1]
  ver[n]        文件版本控制
  vn            使用旧的卷命名体系
  vp            在每个卷之前暂停
  w<path>       指定工作目录
  x<file>       排除指定文件
  x@            排除从标准输入中读取的文件名称
  x@<list>      从指定列表文件中指定要排除的文件
  y             设定所有回答为yes
  z[file]       从文件中读取压缩档案的备注


关于linux/unix的更多讨论与交流,敬请关注本博和新浪微博songzi_tea.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐


linux下开机自启: 在/etc/init.d目录下新建文件elasticsearch 并敲入shell脚本: 注意, 前两行必须填写,且要注释掉。 第一行为shell前行代码,目的告诉系统使用shell。 第二行分别代表运行级别、启动优先权、关闭优先权,且后面添加开机服务会用到。 shell脚本
1、因为在centos7中/etc/rc.d/rc.local的权限被降低了,所以需要赋予其可执行权 chmod +x /etc/rc.d/rc.local 2、赋予脚本可执行权限假设/usr/local/script/autostart.sh是你的脚本路径,给予执行权限 chmod +x /usr
最简单的查看方法可以使用ls -ll、ls-lh命令进行查看,当使用ls -ll,会显示成字节大小,而ls- lh会以KB、MB等为单位进行显示,这样比较直观一些。 通过命令du -h –max-depth=1 *,可以查看当前目录下各文件、文件夹的大小,这个比较实用。 查询当前目录总大小可以使用d
ASP.NET Core应用程序发布linux在shell中运行是正常的。可一但shell关闭网站也就关闭了,所以要配置守护进程, 用的是Supervisor,本文主要记录配置的过程和过程遇到的问题 安装Supervisor&#160;1 yum install python-setuptools
设置时区(CentOS 7) 先执行命令timedatectl status|grep &#39;Time zone&#39;查看当前时区,如果不是时区(Asia/Shanghai),则需要先设置为中国时区,否则时区不同会存在时差。 #已经是Asia/Shanghai,则无需设置 [root@xia
vim&#160;/etc/sysconfig/network-scripts/ifcfg-eth0 BOOTPROTO=&quot;static&quot; ONBOOT=yes IPADDR=192.168.8.106 NETMASK=255.255.252.0 GATEWAY=192.168.
一、安装gcc依赖 由于 redis 是用 C 语言开发,安装之前必先确认是否安装 gcc 环境(gcc -v),如果没有安装,执行以下命令进行安装 [root@localhost local]# yum install -y gcc 二、下载并解压安装包 [root@localhost local
第一步 On CentOS/RHEL 6.*: $ sudo rpm -Uvh http://li.nux.ro/download/nux/dextop/el6/x86_64/nux-dextop-release-0-2.el6.nux.noarch.rpm On CentOS/RHEL 7: $
/// &lt;summary&gt; /// 取小写文件名后缀 /// &lt;/summary&gt; /// &lt;param name=&quot;name&quot;&gt;文件名&lt;/param&gt; /// &lt;returns&gt;返回小写后缀,不带“.”&lt;/ret
which nohup .bash_profile中并source加载 如果没有就安装吧 yum provides */nohup nohup npm run start &amp; nohup ./kibana &amp;
1.1 MySQL安装 1.1.1 下载wget命令 yum -y install wget 1.1.2 在线下载mysql安装包 wget https://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm 1.1.3 安装My
重启 reboot shutdown -r now init 6 关闭 init 0 shutdown -h now shutdown -h 20:25 #8点25关机查看内存 free CPU利用率 top 日期 date 设置时间 date 033017002015 #月日时间年 日历 cal
1、firewalld的基本使用 启动: systemctl start firewalld 关闭: systemctl stop firewalld 查看状态: systemctl status firewalld 开机禁用 : systemctl disable firewalld 开机启用 :
1 下载并安装MySQL官方的&#160;Yum Repository wget -i -c http://dev.mysql.com/get/mysql57-community-release-el7-10.noarch.rpm 使用上面的命令就直接下载了安装用的Yum Repository,大概
CentOS6.x CentOS6中转用Upstrat代替以前的init.d/rcX.d的线性启动方式。 一、相关命令 通过initctl help可以查看相关命令 [root@localhost ~]# initctl help Job commands: start Start job. sto
1、使用命令:df -lk 找到已满磁盘 2、使用命令:du --max-depth=1 -h 查找大文件,删除
ifconfig:查看网卡信息 网卡配置文件位置: /etc/sysconfig/network-scripts/文件夹 nmtui:配置网卡 netstat -tlunp:查看端口信息 端口信息存储位置: /etc/services文件 route:查看路由信息 wget:下载网路文件,例如 wg
ps -ef:查看所有进程,&#160;ps -ef |grap firewalld 查看与firewalld相关的进程 which :查看进程:which firewalld kill 进程id:杀掉进程 kill 640,强制杀:kill -9 640 man:查看帮助,例如 man ps 查看
useradd:添加用户 useradd abc,默认添加一个abc组 vipw:查看系统中用户 groupadd:添加组groupadd ccna vigr:查看系统中的组 gpasswd:将用户abc添加到ccna组 gpasswd -a abc ccna groups abc:查看用户abc属