1

What I want to do is to extract a single file from a huge tar file, instead of extracting the whole tar.

I am using RHEL 6.4

I Googled it and tried the following:

tar --extract --file=some.tar ./env
tar: ./env: Not found in archive
tar: Exiting with failure status due to previous errors
tar -xf some.tar ./env
tar: ./env: Not found in archive
tar: Exiting with failure status due to previous errors

And yes env file does exist in the tar file.

I read the answer given here: extract single file from huge tgz file

Is there any way I can do this single file extraction or not?

2

Try using the -t flag to see how the filename is stored, then specify the same name at the end of your extraction tar command, including any path/directories. As in

tar --extract --file=some.tar exactfilename

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.