LSX-blog

Feed Rss

【转载】RAR for Linux 命令详解

12.01.2011, Linux, by .

Linux下rar命令详解
用法: rar – ….-
a 添加文件到压缩文件
c 添加压缩文件注释
cf 添加文件注释
cw 写入压缩文件注释到文件
d 删除压缩文件中的文件
e 解压压缩文件到当前目录
f 刷新压缩文件中的文件
i [参数]= 在压缩文件中查找字符串

k 锁定压缩文件
l[t,b] 列出压缩文件[技术信息,简洁]
m[f] 移动到压缩文件[仅对文件]
p 打印文件到标准输出设备
r 修复压缩文件
rc 重建丢失的卷
rn 重命名压缩文件
rr[N] 添加数据恢复记录
rv[N] 创建恢复卷
s[名字|-] 转换压缩文件为自解压格式或转换回压缩文件
t 测试压缩文件
u 更新压缩文件中的文件
v[t,b] 详细列出压缩文件[技术信息,简洁]
x 用绝对路径解压文件
示例:
1、rar a file file.ext
如果file.rar不存在将创建file.rar文件;如果file.rar压缩包中已有file.ext,将更新压缩包中的file.ext;还可用d:\*.ext代替file.ext将d盘下所有ext文件(不包括自文件夹)添加到压缩包中。

2、rar a -r -v2000 -s -sfx -rr file
从当前文件夹和子文件夹压缩全部文件成为 2000000 字节大小、固实的、分卷自解压文件 file.part1.exe,file.part2.rar,file.part3.rar 等,并在每一个分卷中添加恢复记录;将命令a换成命令m可将文件压缩后删除

3、rar x Fonts *.ttf
会从压缩文件解压 *.ttf 字体文件到当前文件夹,但下面命令:
rar x Fonts *.ttf NewFonts\
会从压缩文件解压 *.ttf 字体文件到文件夹 NewFont

4、rar a -pZaBaToAd -r secret games\*.*
使用密码 ZaBaToAd 来将文件夹“games”的内容添加到压缩文件“secret”

5、rar a -r a.rar a/
递归的将a/下所有东西压缩到a.rar

rar常用命令主要有
a 添加文件到操作文档
例:rar a test.rar file1.txt 若test.rar文件不存在,则打包file1.txt文件成test.rar
例:rar a test.rar file2.txt 若test.rar文件已经存在,则添加file2.txt文件到test.rar中
(这样test.rar中就有两个文件了)
注,如果操作文档中已有某文件的一份拷贝,则a命令更新该文件,对目录也可以进行操作
例:rar a test.rar dir1

c 对操作文档添加说明注释
rar c test.rar
(会出现Reading comment from stdin字样,然后输入一行或多行注释,以ctrl+d结束)
cf 添加文件注释,类似上面的c,不过这个是对压缩文档中每个文件进行注释

cw 将文档注释写入文件
例:rar cw test.rar comment.txt

d 从文档中删除文件
例:rar d test.rar file1.txt

e 将文件解压到当前目录
例:rar e test.rar
注:用e解压的话,不仅原来的file1.txt和file2.txt被解压到当前目录,就连dir1里面的所有文件
也被解压到当前目录下,不能保持压缩前的目录结构,如果想保持压缩前的目录结构,用x解压

k 锁定文档
例:rar k test.rar 锁定文档后,该文档就无法进行任何更新操作了

r 修复文档
例:rar r test.rar
当rar文件有问题时,可以尝试用该命令进行修复(鬼知道有多少用)

s 转换文档成自解压文档
例:rar s test.rar
会生成一个test.sfx的可执行文档,运行它的效果就相当于rar x test.rar,
适合于向没有rar的用户传输文件

t 检测文档
例:rar t test.rar
检测test.rar的完整性,一般压缩完大型文件准备传输前最好用这个命令来确保文件的正确性

x 带路径解压文档中内容到当前目录
例:rar x test.rar
这样解压的话,dir1就会保持原来的目录结构

以上就是rar的常用命令,一个rar操作只能有一个命令,而选项却可以有多个。
————————————————————————
rar选项有很多,在此无法一一说明,只示范经常使用的几个

cl 将文件名转换为小写
cu 将文件名转换为大写
例:rar a -cl test.rar FILe.txt
FILe.txt在添加进test.rar之后,变为file.txt

df 文档操作后删除源文件
例:rar a -df test.rar file1.txt file2.txt dir1
将file1.txt,file2.txt,dir1压缩到test.rar中之后,删除源文件

ed 不添加空目录
例:rar a -ed test.rar dir1
添加dir1到test.rar中时,不对空目录进行操作
rar e -ed test.rar
解压test.rar时,不生成空目录

k 锁定文件
例:rar a -k test.rar file1.txt
等价于rar a test.rar file1.txt
rar k test.rar

m设定压缩比等级(0-存储,3-默认,5-最大)
例:rar a -m0 test.rar dir1 dir2
将dir1,dir2打包存储到test.rar,不进行实质上的压缩(速度奇快,适合于对无甚可压的文件进行操作
比如avi,jpg等)
rar a -m5 test.rar *.txt *.bmp
将当前目录下的txt文件和bmp文件打包压缩到test.rar中,使用最大压缩比(最慢)

ms[ext;ext] 特定文件采用非压缩方式
例:rar a -m5 -ms avi;jpg;jpeg test.rar /home
将home目录下所有目录和文件归档到test.rar,采用最大压缩,但avi,jpg,jpeg文件不进行压缩
(只是打包进test.rar,因为这些文件即使用最大压缩也压不了多少,不如直接打包节省时间)

o+ 覆盖已有文件
o- 不覆盖已有文件
例:rar x -o- test.rar
解压test.rar文件,但是如果碰到以存在的文件则不覆盖

ol 将符号链接以链接文件保存,而不是普通文件
ow 保存或者恢复文件所有者的信息(username,group)
这两个是*nix系统特有的命令,很容易理解吧
————————————————————————
p[password] 设定密码
例:rar a test.rar *.txt -p prettygirl
压缩文件设定密码为prettygirl,解压时无密码无法进行操作
如果觉得明码密码太过暴露,可以使用
rar a test.rar *.txt -p
则rar程序会询问你要使用什么密码,不回显

s- 不使用固实压缩
注,固实压缩就是压缩后文档内容不可变更的压缩方式,这和lock不一样。因为使用普通压缩
要照顾以后的插入删除个别文件的需要,就要留下很多操作余地。而固实压缩则不可以对
其内容进行任何更新,所以压缩比是最大的。

sfx[name] 创建自解压文件,这和先用a进行压缩,再用s转换效果是一样的。

t 压缩完毕后进行完整性检验
例:rar a test.rar /home -t
压缩完毕后进行检验,如果有问题则报错

【转载】RAR for Linux 命令详解 有 42 条回应

  1. I used to be able to find good info from your blog articles.

    回复
  2. Thank you for sharing your info. I truly appreciate your
    efforts and I am waiting for your next write
    ups thank you once again.

    回复
  3. Fantastic beat ! I would like to apprentice at the same time as you amend your website, how could i subscribe for a weblog web site?
    The account helped me a applicable deal. I have been a little bit acquainted of
    this your broadcast provided vibrant clear concept

    回复
  4. Howdy! I know this is kind of off topic but I was wondering which blog platform are you using for this website?
    I’m getting tired of WordPress because I’ve had problems with hackers and I’m looking at options for another platform.
    I would be awesome if you could point me in the direction of a good
    platform.

    回复
  5. Pretty section of content. I just stumbled upon your site and in accession capital
    to assert that I acquire in fact enjoyed account your blog posts.
    Any way I’ll be subscribing to your augment and even I achievement you access
    consistently quickly.

    回复
  6. Painter And Decorator Gloucester
    38 Bruton Way
    Gloucester GL1 1DA, United Kingdom
    01452 223268

    回复
  7. Saved as a favorite, I love your web site!

    回复
  8. For hottest information you have to pay a visit web and on the web I found this website as a finest web page for newest updates.|

    回复
  9. Quality posts is the crucial to invite the users to pay a visit the web page, that’s what this web
    page is providing.

    回复
  10. It’s very simple to find out any matter on web as compared to books,
    as I found this paragraph at this web page.

    回复
  11. I used to be able to find good advice from your content.

    回复
  12. I used to be able to find good advice from your blog articles.

    回复
  13. Everything is very open with a precise description of the issues.
    It was really informative. Your website is extremely helpful.

    Many thanks for sharing!

    回复
  14. It’s very effortless to find out any matter on net as compared
    to books, as I found this piece of writing at this web page.

    回复
  15. Since the admin of this web site is working, no hesitation very shortly it
    will be famous, due to its quality contents.

    回复
  16. Fantastic beat ! I would like to apprentice while you amend your
    web site, how can i subscribe for a weblog web site?
    The account helped me a applicable deal. I had been a
    little bit acquainted of this your broadcast provided
    vivid transparent idea

    回复
  17. It’s wonderful that you are getting ideas from this paragraph
    as well as from our discussion made at this place.

    回复
  18. I simply could not go away your website before suggesting that
    I extremely enjoyed the usual information an individual provide in your visitors?
    Is going to be back regularly to investigate cross-check new posts

    回复
  19. This design is incredible! You most certainly know how to keep a reader
    entertained. Between your wit and your videos, I was almost moved to
    start my own blog (well, almost…HaHa!) Wonderful job.
    I really enjoyed what you had to say, and more than that, how you presented it.
    Too cool!

    回复
  20. Greetings from Florida! I’m bored to tears at
    work so I decided to browse your site on my iphone
    during lunch break. I love the knowledge you provide here and
    can’t wait to take a look when I get home. I’m shocked
    at how quick your blog loaded on my phone ..
    I’m not even using WIFI, just 3G .. Anyhow, fantastic site!

    回复
  21. It’s appropriate time to make some plans for the longer term and it is time to be happy.
    I’ve read this submit and if I may just I want to recommend you few attention-grabbing issues or advice.
    Maybe you can write next articles regarding this article. I wish to read more things about it!

    回复
  22. No matter if some one searches for his essential thing, thus he/she needs
    to be available that in detail, therefore that thing is maintained over here.

    回复
  23. I was curious if you ever thought of changing the structure of your site?
    Its very well written; I love what youve got to say.
    But maybe you could a little more in the way of
    content so people could connect with it better. Youve got an awful lot
    of text for only having 1 or two images. Maybe you could space it out better?

    回复
  24. Hello, this weekend is fastidious in support of me, as this occasion i am reading this
    enormous informative piece of writing here at my house.

    回复
  25. My family members every time say that I am wasting my time
    here at net, except I know I am getting knowledge everyday
    by reading thes nice articles or reviews.

    回复
  26. Have you ever considered creating an ebook or guest authoring on other websites?

    I have a blog based on the same ideas you discuss and would really like to have you share some stories/information. I know my viewers would
    enjoy your work. If you’re even remotely interested, feel free to shoot me an e mail.

    回复
  27. Thank you for another informative site. Where else may I am getting that kind of info written in such a
    perfect way? I’ve a challenge that I’m just now running on, and I’ve
    been on the glance out for such info.

    回复
  28. What’s up, its fastidious paragraph concerning media print,
    we all be familiar with media is a impressive source of information.

    回复
  29. Appreciation to my father who informed me about this blog, this
    blog is in fact awesome.

    回复
  30. Good day! This post could not be written any better! Reading through this post reminds me of my old room mate!
    He always kept talking about this. I will forward this write-up to him.
    Fairly certain he will have a good read. Many thanks for sharing!

    回复
  31. Good way of describing, and pleasant article to get facts regarding my presentation subject, which i am going to present in college.

    回复
  32. Magnificent goods from you, man. I’ve understand
    your stuff previous to and you are just extremely fantastic.

    I really like what you’ve acquired here, really like
    what you are saying and the way in which you say it.
    You make it enjoyable and you still care for to
    keep it wise. I can’t wait to read far more from you.
    This is really a great website.

    回复
  33. There’s definately a great deal to know about this issue.
    I love all the points you have made.

    回复
  34. My relatives every time say that I am wasting my time here at
    net, however I know I am getting knowledge everyday
    by reading such fastidious articles.

    回复
  35. Just desire to say your article is as astonishing.
    The clearness in your post is simply cool and i could assume you are an expert on this subject.

    Fine with your permission allow me to grab your RSS feed to keep
    updated with forthcoming post. Thanks a million and please
    carry on the rewarding work.

    回复
  36. Thanks for some other informative blog. Where else may I
    get that type of info written in such an ideal method?
    I’ve a mission that I’m simply now working on, and I’ve been at the look
    out for such info.

    回复
  37. Hi there to all, how is all, I think every one is getting more from this website, and your views are
    pleasant designed for new visitors.

    回复
  38. Hey very cool site!! Man .. Beautiful .. Amazing ..
    I will bookmark your website and take the feeds additionally?
    I’m happy to search out so many useful information right here within the post, we’d like develop more strategies on this regard, thank you for sharing.
    . . . . .

    回复
  39. Thanks for the marvelous posting! I quite enjoyed reading
    it, you will be a great author. I will make certain to
    bookmark your blog and will eventually come back someday. I want to encourage yourself to continue your great work, have a nice afternoon!

    回复
  40. Excellent web site you have got here.. It’s difficult to find high-quality writing like yours these days.
    I really appreciate individuals like you! Take care!!

    回复
  41. This design is wicked! You most certainly know how to keep a reader amused.
    Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Fantastic job.
    I really loved what you had to say, and more than that, how you presented it.

    Too cool!

    回复
  42. What’s up to all, how is everything, I think every one is
    getting more from this website, and your views are good in favor
    of new users.

    回复

发表评论

电子邮件地址不会被公开。 必填项已用*标注