iaav
iaav

Reputation: 466

How to extract a tar file inside a tar file

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

Upvotes: 4

Views: 4132

Answers (1)

konsolebox
konsolebox

Reputation: 75488

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

Upvotes: 4

Related Questions