最近遇到一个.patch.gz文件,以为像.tar.gz一样,直接将其用tar去解压,结果不支持:
[crifan@linux-41lh linux-2.6.28.4]$tar xvfz easypoint_v0.3.patch.gz
tar: This does not look like a tar archive
tar: Skipping to next header
tar: Error exit delayed from previous errors
网上找了下,说是用gunzip解压,看了下用法:
[crifan@linux-41lh linux-2.6.28.4]$gunzip -h
Usage: gzip [OPTION]… [FILE]…
Compress or uncompress FILEs (by default, compress FILES in-place).
Mandatory arguments to long options are mandatory for short options too.
-c, –stdout write on standard output, keep original files unchanged
-d, –decompress decompress
-f, –force force overwrite of output file and compress links
-h, –help give this help
-l, –list list compressed file contents
-L, –license display software license
-n, –no-name do not save or restore the original name and time stamp
-N, –name save or restore the original name and time stamp
-q, –quiet suppress all warnings
-r, –recursive operate recursively on directories
-S, –suffix=SUF use suffix SUF on compressed files
-t, –test test compressed file integrity
-v, –verbose verbose mode
-V, –version display version number
-1, –fast compress faster
-9, –best compress better
With no FILE, or when FILE is -, read standard input.
Report bugs to <[email protected]>.
其中,-d就是解压缩,所以去试了试:
[crifan@linux-41lh linux-2.6.28.4]$gunzip -d easypoint_v0.3.patch.gz
结果是可以的,但是没有任何提示,直接将原先easypoint_v0.3.patch.gz 变成了easypoint_v0.3.patch,而且原先的那个文件也被删除了。。。
所以又去试了试-cd是啥效果:
gunzip -cd easypoint_v0.3.patch.gz
结果是原始文件没动,解压后的patch内容,都输出到当前终端了。。
如果加上-v参数,表示–verbose,输出详细信息:
[crifan@linux-41lh linux-2.6.28.4]$gunzip -dv easypoint_v0.3.patch.gz
easypoint_v0.3.patch.gz: 74.4% — replaced with easypoint_v0.3.patch
【总结】
1。只是要简单的解压.patch.gz文件的话,直接用
gunzip -d XXX.patch.gz
即可得到解压后的文件XXX.patch,同时删除原始文件XXX.patch.gz
2。如果要保留原始文件,并将解压后的文件解压再输出到当前终端,那么可以用
gunzip -cd XXX.patch.gz
这样,会保留原始文件,并且将解压后的patch内容输出到当前终端。
【引用】
1。.patch.gz文件如何解压?
http://bbs.51cto.com/thread-628553-1.html
转载请注明:在路上 » 【整理】如何解压.patch.gz文件