Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

What is the idiomatic way to do the following

  • tar to stdout
  • read this tar output from stdout and extract to some other folder.

My solution is tar --to-stdout .. | tar -C somefolder -xvf -

But may be there is more idiomatic way to do it.

share|improve this question
add comment

1 Answer

up vote 5 down vote accepted

The same -f - option works for tarring as well.

tar -cf - something | tar -C somefolder -xvf -

GNU tar uses stdio by default:

tar -c something | tar -C somefolder -xv

rsync is also popular.

rsync -av something/ somefolder/
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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