linux下解壓rar檔案

regonly1發表於2012-03-31
rar是一個在windows下盛行的壓縮格式,到了linux/unix環境下,卻連找個解壓縮的工具都很難找到。網上找了下,發現7zip可以用來解壓這個。順便記錄下解決過程:
1、安裝以下程式:
-rw-r--r--  1 root root     2152153 Mar 31 10:56 p7zip_9.20.1_x86_linux_bin.tar.bz2
-rw-r--r--  1 root root     3835235 Mar 31 10:56 p7zip_9.20.1_src_all.tar.bz2
2、分別解壓得到:
p7zip_9.20.1目錄
3、進入p7zip_9.20.1目錄,安裝:
[root@DB p7zip_9.20.1]# ./install.sh
- installing /usr/local/bin/7za
- installing /usr/local/bin/7zr
- installing /usr/local/bin/7z
- installing /usr/local/lib/p7zip/7zCon.sfx
- installing /usr/local/lib/p7zip/7z.so
- installing /usr/local/lib/p7zip/Codecs
- installing /usr/local/man/man1/7z.1
- installing /usr/local/man/man1/7za.1
- installing /usr/local/man/man1/7zr.1
- installing /usr/local/share/doc/p7zip/README
- installing /usr/local/share/doc/p7zip/ChangeLog
- installing HTML help in /usr/local/share/doc/p7zip/DOCS

總共有三類命令:7z 7zr 7za,作用:
  7z uses plugins (7z.so and Codecs/Rar29.so) to handle archives.
  7za is a stand-alone executable.
  7za handles less archive formats than 7z.exe.
  7zr is a light stand-alone executable that supports only 7z/LZMA/BCJ/BCJ2.

所以用7z來解壓,先看下命令格式:
[root@DB p7zip_9.20.1]# 7z

7-Zip 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,2 CPUs)

Usage: 7z [...] [...]
       []


  a: Add files to archive
  b: Benchmark
  d: Delete files from archive
  e: Extract files from archive (without using directory names)
  l: List contents of archive
  t: Test integrity of archive
  u: Update files to archive
  x: eXtract files with full paths

  -ai[r[-|0]]{@listfile|!wildcard}: Include archives
  -ax[r[-|0]]{@listfile|!wildcard}: eXclude archives
  -bd: Disable percentage indicator
  -i[r[-|0]]{@listfile|!wildcard}: Include filenames
  -m{Parameters}: set compression Method
  -o{Directory}: set Output directory
  -p{Password}: set Password
  -r[-|0]: Recurse subdirectories
  -scs{UTF-8 | WIN | DOS}: set charset for list files
  -sfx[{name}]: Create SFX archive
  -si[{name}]: read data from stdin
  -slt: show technical information for l (List) command
  -so: write data to stdout
  -ssc[-]: set sensitive case mode
  -t{Type}: Set type of archive
  -u[-][p#][q#][r#][x#][y#][z#][!newArchiveName]: Update options
  -v{Size}[b|k|m|g]: Create volumes
  -w[{path}]: assign Work directory. Empty path means a temporary directory
  -x[r[-|0]]]{@listfile|!wildcard}: eXclude filenames
  -y: assume Yes on all queries

起先以為這麼解壓就行了:
7z -e xx.rar
但是報:
[oracle@DB ~]$ 7z -e wind_20120101.rar


Error:
Incorrect command line
奇怪,難道跟正常的格式不一樣麼?所以又回過頭去仔細學習了下命令格式。
重新再來:
[oracle@DB ~]$ 7z e -slt wind_20120101.rar

7-Zip 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18
p7zip Version 9.20 (locale=en_US,Utf16=on,HugeFiles=on,2 CPUs)

Processing archive: wind_20120101.rar

這下可以了。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12932950/viewspace-720028/,如需轉載,請註明出處,否則將追究法律責任。

相關文章