How to cat a text file out from a tar archive without having to extracting it?

How to cat a text file out from a compressed tar archive package without having to extracting the whole package?

For example, I have a pkg.tar.gz which contains a text file pkg/readme.txt in it. How to cat the pkg/readme.txt file content out?

You may use this command to cat out the file content:

tar -O -xf pkg.tar.gz pkg/version.txt
Leave a Reply

Your email address will not be published. Required fields are marked *