Updating a single file in a compressed tar

Posted by Phil on Stack Overflow See other posts from Stack Overflow or by Phil
Published on 2010-06-02T08:55:58Z Indexed on 2010/06/02 9:13 UTC
Read the original article Hit count: 294

Filed under:
|

Given a compressed archive file such as application.tar.gz which has a folder application/x/y/z.jar among others, I'd like to be able to take my most recent version of z.jar and update/refresh the archive with it.

Is there a way to do this other than something like the following?

tar -xzf application.tar.gz
cp ~/myupdatedfolder/z.jar application/x/y
tar -czf application application.tar.gz

I understand the -u switch in tar may be of use to avoid having to untar the whole thing, but I'm unsure how to use it exactly.

© Stack Overflow or respective owner

Related posts about linux

Related posts about tar