Linux文件解压一些技巧
Linux文件解压一些技巧
Linux文件解压一些技巧
tar解压缩文件
常用命令选项
-x : 解压文件
-c : 创建压缩文件
-z : 通过gzip压缩文件或者gunzip/ungzip解压文件
-j : 解压缩bzip2格式文件
-v : 显示每一步处理的文件信息
-f : 指定要处理的文件名
tar -cf archive.tar foo bar # Create archive.tar from files foo and bar.
tar -tvf archive.tar # List all files in archive.tar verbosely.
tar -xf archive.tar # Extract all files from archive.tar.
使用技巧:
1、如果只查看压缩包中的文件,不解压,使用tar -tvf
2、如果一个压缩包很大,但是只想解压出其中的几个文件,提取所需的文件的方法为
tar xvf log.tar.gz iphone.log #只提取log.tar.gz压缩包中的iphone.log文件
tar -xzvf shanghai_20130916log.tar.gz *_access_third.log。
可以上面的技巧1一起使用,可以方便操作比较大的压缩包。
评论暂时关闭