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- Igor Pavlov -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_.rar
Error:
Incorrect command line
奇怪,难道跟正常的格式不一样么?所以又回过头去仔细学习了下命令格式。
重新再来:
[oracle@DB ~]$7z e -slt wind_.rar
7-Zip 9.20 Copyright (c) 1999- Igor Pavlov -11-18
p7zip Version 9.20 (locale=en_US,Utf16=on,HugeFiles=on,2 CPUs)
Processing archive: wind_.rar
这下可以了。
来自 “ ITPUB博客 ” ,链接:/12932950/viewspace-720028/,如需转载,请注明出处,否则将追究法律责任。
如果觉得《linux解压rar文件 linux下解压rar文件》对你有帮助,请点赞、收藏,并留下你的观点哦!