虚位以待(AD)
虚位以待(AD)
首页 > 操作系统 > RedHat/Centos > CentOS安装rar及用法

CentOS安装rar及用法
类别:RedHat/Centos   作者:码皇   来源:松子茶的专栏     点击:

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

安装步骤如下:
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.htmrar/acknow.txtrar/readme.txtrar/rar_staticrar/default.sfxrar/license.txtrar/rarfiles.lstrar/whatsnew.txtrar/makefilerar/rarrar/unrarrar/rar.txt[root@localhost Downloads]# cd rar[root@localhost rar]# lsacknow.txt license.txt order.htm rarfiles.lst rar.txt unrardefault.sfx makefile rar rar_static readme.txt whatsnew.txt[root@localhost rar]# makemkdir -p /usr/local/binmkdir -p /usr/local/libcp rar unrar /usr/local/bincp rarfiles.lst /etccp default.sfx /usr/local/lib[root@localhost rar]# rarRAR 5.40 beta 2 Copyright (c) 1993-2016 Alexander Roshal 30 May 2016Trial version Type RAR -? for helpUsage: 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
 
 
- - <@listfiles...> <命令>
    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]= 在档案中查找特定字符 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 在档案内部设置路径 as 同步档案内目录 av 设置认证检测(只有注册版提供此功能) av- 关闭认证检测 c- 关闭备注显示 cfg- 关闭读取设置 cl 转换名称为小写字母 cu 转换名称为大写字母 df 压缩后删除原文件 dh 打开共享文件 ds 关闭针对于稳固档案的名称排序 dw 压缩后擦除文件 e[+] 设置文件排除与包含属性 ed 不添加空目录 en 不设置档案结束块 ep 名称中不包含路径 ep1 名称中不包含基本文件目录 ep3 展开路径到完整包含的驱动器名 f 刷新文件 hp[password] 加密文件数据和文件头部 id[c,d,p,q] 关闭消息 ierr 发送所有消息到标准错误输出 ilog[name] 记录错误日志到文件中(只有注册版提供此功能) inul 关闭所有消息 isnd 打开声音 k 锁定压缩档案 kb 保持被解压过的已损坏的文件 m<0..5> 设置压缩等级(0-存储...3-默认...5-最大) mc 设置高级压缩参数 md Dictionary size in KB (64,128,256,512,1024,2048,4096 or A-G) ms[ext;
    ext] 存储指定的文件类型 n 仅包含指定的文件 n@ 从标准输入读取文件名到包含内容中 n@ 在指定列表文件中包含文件 o[+|-] 设置重写模式 ol 替文件保存符号连接作为连接 or 自动重命名文件 ow 保存活存储文件的拥有者与群组 p[password] 设置密码 p- 不询问密码 r 对子目录进行递归操作 r0 仅用通配符名称对子目录进行递归操作 rr[N] 添加数据恢复记录 rv[N] 创建恢复 s[,v[-],e] 创建稳固档案压缩 s- 关闭稳固档案压缩 sc[obj] 设置指定的字符串 sfx[name] 创建SFX档案 si[name] 从标准输入读取数据 sl 处理文件的大小小于指定的值 sm 处理文件的大小大于指定的值 t 压缩后测试文件 ta 处理修改日期为指定日期之后的文件,格式: YYYYMMDDHHMMSS tb 处理修改日期为指定日期之前的文件,格式: YYYYMMDDHHMMSS tk 保持档案最初的时间 tl 设置档案时间为据现在最近的文件时间 tn
 
相关热词搜索: