大家一般常用的壓縮格式是.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需要自己安裝。