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.
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.Sign up to join this community
Just adding another use-case here. I had a large directory structure on a system nearly out of disk space and wanted to end up with a tar.gz file of the directory structure on another machine with lots of space.
tar -czf - big-dir | ssh user@host 'cat > /path/to/big-dir.tar.gz'
This saves on network overhead and means you don't have to tar on the other side in case you'd wanted to use rsync for the transfer instead.