大家一般常用的压缩格式是.tar.gz .zip等,国际通用的压缩文件格式是zip文件。今天在redhat下使用了windows下常用的.rar文件。用到的解压缩命令符是unrar,用法如下:
linux-i206-100:/root # unrar --help
UNRAR 3.51 freeware Copyright (c) 1993-2005 Alexander Roshal
Usage: unrar <command> -<switch 1> -<switch N> <archive> <files...>
<@listfiles...> <path_to_extract/>
<Commands>
e Extract files to current directory
l[t,b] List archive [technical, bare]
p Print file to stdout
t Test archive files
v[t,b] Verbosely list archive [technical,bare]
x Extract files with full path
<Switches>
- Stop switches scanning
ad Append archive name to destination path
ap<path> Set path inside archive
av- Disable authenticity verification check
c- Disable comments show
cfg- Disable read configuration
cl Convert names to lower case
cu Convert names to upper case
dh Open shared files
ep Exclude paths from names
ep3 Expand paths to full including the drive letter
f Freshen files
id[c,d,p,q] Disable messages
ierr Send all messages to stderr
inul Disable all messages
kb Keep broken extracted files
n<file> Include only specified file
n@ Read file names to include from stdin
n@<list> Include files in specified list file
o+ Overwrite existing files
o- Do not overwrite existing files
ow Save or restore file owner and group
p[password] Set password
p- Do not query password
r Recurse subdirectories
ta<date> Process files modified after <date> in YYYYMMDDHHMMSS format
tb<date> Process files modified before <date> in YYYYMMDDHHMMSS format
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 List all volumes
ver[n] File version control
vp Pause before each volume
x<file> Exclude specified file
x@ Read file names to exclude from stdin
x@<list> Exclude files in specified list file
y Assume Yes on all queries
常用的命令组合:unrar x filename.rar path_to_extract
注意:如果你的压缩包里有子文件夹,那就不要用unrar e filename.rar,因为解压后压缩包里的文件不再按文件夹分级放在目标文件夹里,而是所有的文件全部放在目标文件夹这一层里面。
一般系统默认安装了unrar,压缩的工具rar需要自己安装。