How to extract a tar file inside a tar file

2019-07-31 14:16发布

I need help to extract a tar file inside a tar. I can extract the parent tar and then untar the child tar but trying to see if there any way to just extract the child tar without untaring parent tar..

eg:

tar -tf parent.tar

parent/
parent/child.tar
parent/file1
parent/file2
parent/file3

1条回答
爷的心禁止访问
2楼-- · 2019-07-31 14:51

You should add an argument to match the file inside the tar and use -O or --to-stdout to extract data to stdout to pipe and use another tar to extract it:

tar -xOf parent.tar parent/child.tar | tar -x
查看更多
登录 后发表回答