没有特殊原因,文档如果要传到linux上,一定要打成*.zip格式,这样方便解压,一般来说没有理由要用rar,关于
linux上unzip命令有空细讲,本节讲下,如何让linux支持解压缩rar文件?
一 、系统环境
1. 系统环境
实验环境一:CentOSrelease5.5(Final)
2.6.18-194.el5
x86_64GNU/Linux
实验环境二:CentOSrelease5.4(Final)
2.6.18-164.el5
i686GNU/Linux
2. 命令查看方法[root@oldboytools]#cat/etc/redhat-release
CentOSrelease5.5(Final)
[root@oldboytools]#uname-r
2.6.18-194.el5
[root@oldboytools]#uname-m
x86_64
二、下载并安装rar软件
1. 下载mkdir-p/home/oldboy/tools
cd/home/oldboy/tools
wget/rar/rarlinux-3.8.0.tar.gz
2. 安装tarzxvfrarlinux-3.8.0.tar.gz
cdrar
make
makeinstall
三、rar命令语法
将/etc 目录压缩为etc.rar 命令为:raraetc.rar/etc
将etc.rar 解压 命令为:rarxetc.rar
unrar-eetc.tar
四、具体例子
实例:将/etc 目录压缩为etc.rar[root@oldboytools]#raraetc.rar/etc
RAR3.80Copyright(c)1993-AlexanderRoshal16Sep
SharewareversionTypeRAR-?forhelp
Evaluationcopy.Pleaseregister.
Creatingarchiveetc.rar
Adding/etc/gdm/securitytokens.confOK
Adding/etc/gdm/Init/DefaultOK
Adding/etc/gdm/custom.confOK
Adding/etc/gdm/XsessionOK
Adding/etc/gdm/PostSession/DefaultOK
Adding/etc/gdm/PreSession/DefaultOK
Adding/etc/gdm/XKeepsCrashingOK
Adding/etc/gdm/locale.aliasOK
Adding/etc/gdm/PostLogin/Default.sampleOK
省略若干行......
查看[root@oldboytools]#ll
总计 26704-rw-r--r--1rootroot2650564508-:26etc.rar
将etc.rar 解压:[root@oldboytools]#rarxetc.rar
RAR3.80Copyright(c)1993-AlexanderRoshal16Sep
SharewareversionTypeRAR-?forhelp
Extractingfrometc.rar
CreatingetcOK
Creatingetc/gdmOK
Extractingetc/gdm/securitytokens.confOK
Creatingetc/gdm/InitOK
Extractingetc/gdm/Init/DefaultOK
Extractingetc/gdm/custom.confOK
Extractingetc/gdm/XsessionOK
Creatingetc/gdm/PostSessionOK
Extractingetc/gdm/PostSession/DefaultOK
省略若干行......
五、更多命令 查看帮助[root@oldboyrar]#rar
RAR3.80Copyright(c)1993-AlexanderRoshal16Sep
SharewareversionTypeRAR-?forhelp
Usage:rar--
aAddfilestoarchive
c
Addarchivecomment
cfAddfilescomment
ch
Changearchiveparameters
cwWritearchivecommenttofile
dDeletefilesfromarchive
eExtractfilesto
currentdirectory
fFreshenfilesinarchive
i[par]=Findstringinarchives
kLockarchive
l[t,b]Listarchive[technical,bare]
m[f]Movetoarchive
[filesonly]
pPrintfiletostdout
rRepair
archive
rcReconstructmissingvolumes
rnRename
archivedfiles
rr[N]Adddatarecoveryrecord
rv[N]
Createrecoveryvolumes
s[name|-]ConvertarchivetoorfromSFX
tTestarchivefiles
uUpdatefilesinarchive
v[t,b]Verboselylistarchive[technical,bare]
xExtract
fileswithfullpath
-Stopswitchesscanning
ad
Appendarchivenametodestinationpath
ag[format]Generatearchivename
usingthecurrentdate
apSetpathinsidearchive
asSynchronizearchivecontents
avPutauthenticity
verification(registeredversionsonly)
av-Disableauthenticity
verificationcheck
c-Disablecommentsshow
cfg-
Disablereadconfiguration
clConvertnamestolowercase
cuConvertnamestouppercase
dfDeletefilesafter
archiving
dhOpensharedfiles
dsDisablename
sortforsolidarchive
dwWipefilesafterarchiving
e[+]Setfileexcludeandincludeattributes
ed
Donotaddemptydirectories
enDonotput'endofarchive'
block
epExcludepathsfromnames
ep1Exclude
basedirectoryfromnames
ep3Expandpathstofullincludingthe
driveletter
fFreshenfiles
hp[password]Encryptboth
filedataandheaders
id[c,d,p,q]Disablemessages
ierr
Sendallmessagestostderr
ilog[name]Logerrorstofile(registered
versionsonly)
inulDisableallmessages
isndEnable
sound
kLockarchive
kbKeepbrokenextracted
files
m<0..5>Setcompressionlevel
(0-store...3-default...5-maximal)
mcSetadvanced
compressionparameters
mdDictionarysizeinKB
(64,128,256,512,1024,2048,4096orA-G)
ms[ext;ext]Specifyfiletypesto
store
nIncludeonlyspecifiedfile
n@
Readfilenamestoincludefromstdin
n@Includefilesinspecifiedlist
file
o[+|-]Settheoverwritemode
olSavesymbolic
linksasthelinkinsteadofthefile
orRenamefiles
automatically
owSaveorrestorefileownerandgroup
p[password]Setpassword
p-Donotquerypassword
rRecursesubdirectories
r0Recursesubdirectories
forwildcardnamesonly
rr[N]Adddatarecoveryrecord
rv[N]Createrecoveryvolumes
s[,v[-],e]Createsolid
archive
s-Disablesolidarchiving
sc[obj]
Specifythecharacterset
sfx[name]CreateSFXarchive
si[name]Readdatafromstandardinput(stdin)
sl
Processfileswithsizelessthanspecified
smProcess
fileswithsizemorethanspecified
tTestfilesafter
archiving
taProcessfilesmodifiedafterin
YYYYMMDDHHMMSSformat
tbProcessfilesmodifiedbefore
inYYYYMMDDHHMMSSformat
tkKeeporiginalarchive
time
tlSetarchivetimetolatestfile
tn
Processfilesnewerthan
toProcessfiles
olderthan
ts[N]Saveorrestorefiletime
(modification,creation,access)
uUpdatefiles
vCreatevolumeswithsizeautodetectionorlistallvolumes
v[k,b]Createvolumeswithsize=*1000[*1024,*1]
ver[n]Fileversioncontrol
vnUsetheoldstylevolume
namingscheme
vpPausebeforeeachvolume
wAssignworkdirectory
xExclude
specifiedfile
x@Readfilenamestoexcludefromstdin
x@Excludefilesinspecifiedlist
file
yAssumeYesonallqueries
z[file]Read
archivecommentfromfile
[root@ha-1-1rar]#unrar
UNRAR3.80freewareCopyright(c)1993-AlexanderRoshal
Usage:unrar--
eExtractfilestocurrentdirectory
l[t,b]Listarchive[technical,bare]
pPrintfileto
stdout
tTestarchivefiles
v[t,b]Verboselylist
archive[technical,bare]
xExtractfileswithfullpath
-Stopswitchesscanning
ad
Appendarchivenametodestinationpath
apSetpathinside
archive
av-Disableauthenticityverificationcheck
c-Disablecommentsshow
cfg-Disableread
configuration
clConvertnamestolowercase
cu
Convertnamestouppercase
dhOpensharedfiles
epExcludepathsfromnames
ep3Expandpathstofull
includingthedriveletter
fFreshenfiles
id[c,d,p,q]
Disablemessages
ierrSendallmessagestostderr
inulDisableallmessages
kbKeepbrokenextracted
files
nIncludeonlyspecifiedfile
n@
Readfilenamestoincludefromstdin
n@Includefilesinspecifiedlist
file
o[+|-]Settheoverwritemode
orRenamefiles
automatically
owSaveorrestorefileownerandgroup
p[password]Setpassword
p-Donotquerypassword
rRecursesubdirectories
slProcessfileswith
sizelessthanspecified
smProcessfileswithsizemore
thanspecified
taProcessfilesmodifiedafter
inYYYYMMDDHHMMSSformat
tbProcessfiles
modifiedbeforeinYYYYMMDDHHMMSSformat
tn
Processfilesnewerthan
toProcessfiles
olderthan
ts[N]Saveorrestorefiletime
(modification,creation,access)
uUpdatefiles
vListallvolumes
ver[n]Fileversioncontrol
vpPausebeforeeachvolume
xExclude
specifiedfile
x@Readfilenamestoexcludefromstdin
x@Excludefilesinspecifiedlist
file
yAssumeYesonallqueries
如果觉得《linux rar 怎么解压文件 如何在linux下解压缩rar格式的文件压缩包?》对你有帮助,请点赞、收藏,并留下你的观点哦!