tar 只解压tar包中某个文件

sh-4.1# ls
test.tar
sh-4.1# tar -tf test.tar 
./ecs20161207.png
./ecs.png
./ecs.xml
./rds.png
./Screenshot-1.png
./Screenshot.png
./TMP/
./TMP/Screenshot-2.png
./TMP/2016-11-24.xlsx
./TMP/elk2.png
./TMP/Screenshot.png
./TMP/img003.png
./TMP/ELK.txt
./TMP/win7开启NFS功能报错.png
./TMP/Diagram1.dia.autosave
./TMP/Screenshot-7.png
./TMP/Screenshot-3.png
./TMP/105354821.png.gif
./TMP/nginx_hosts.config
./TMP/img002.png
./TMP/367_022_6be.jpg
./TMP/20160429111734088.png
./TMP/131441247.jpg
./TMP/Screenshot-9.png
./TMP/ELK.png
./TMP/Screenshot-1.png
./TMP/k.txt
./TMP/img005.png
./TMP/24.png
./TMP/img004.png
./TMP/Screenshot-10.png
./TMP/20151229094001_642.png
./TMP/Screenshot-5.png
./TMP/haproxy.cng
./TMP/nfs.bat
./TMP/lADOdXWNqc0FNs0C7g_750_1334.jpg_620x10000q90g.jpg
./TMP/teamviewer.png
./TMP/Screenshot-8.png
./TMP/ftp无法豋录.png
./TMP/Screenshot-6.png
./TMP/d.png
./TMP/nfs_nb.bat
./TMP/Screenshot-4.png
./TMP/tcping.png
./Untitled 1.odt
#查看tar文件所列出的文件

解压tar包中的./TMP/d.png文件

 

sh-4.1# tar -xvf test.tar ./TMP/d.png
./TMP/d.png
sh-4.1# ls
test.tar  TMP
sh-4.1# tree TMP/
TMP/
└── d.png

0 directories, 1 file

 

你可能感兴趣的:(tar 只解压tar包中某个文件)