查看压缩包文件的命令

发布时间:2014-03-14 23:49:10 阅读:1235次

linux下如何查看tar压缩包里面的内容,不想解压,因为解压文件太大,我只想查看一下里面有没有我要找的东西
tar tvf Package_name.tar 我想要查看里面内容的某一行,怎么弄
两种方法,但都需要你知道要看的内容的关键字:
1、使用grep:
tar tvf Package_name.tar | grep Key_work
例如:
root@rhel55-37 ~]# tar tvf bb.tar
-rw-r--r-- root/root 200 2011-10-20 17:27:00 aa
-rw------- root/root 1303 2011-10-13 19:10:07 anaconda-ks.cfg
drwxr-xr-x root/root 0 2011-10-13 19:38:54 Desktop/
-rw-r--r-- root/root 37640 2011-10-13 19:09:59 install.log
-rw-r--r-- root/root 4404 2011-10-13 19:08:45 install.log.syslog
[root@rhel55-37 ~]# tar tvf bb.tar |grep log
-rw-r--r-- root/root 37640 2011-10-13 19:09:59 install.log
-rw-r--r-- root/root 4404 2011-10-13 19:08:45 install.log.syslog
2、直接指定文件名或通配符
tar tvf Package_name.tar [filename;*keyword*]
[root@rhel55-37 ~]# tar tvf bb.tar install.log
-rw-r--r-- root/root 37640 2011-10-13 19:09:59 install.log
[root@rhel55-37 ~]# tar tvf bb.tar *log*
-rw-r--r-- root/root 37640 2011-10-13 19:09:59 install.log
-rw-r--r-- root/root 4404 2011-10-13 19:08:45 install.log.syslog

如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术

支付宝 微信

有疑问联系站长,请联系QQ:QQ咨询
上一篇:imagick的使用

转载请注明:查看压缩包文件的命令 出自老鄢博客 | 欢迎分享