The Computer Oracle

extract a few members from tar archive and pipe through network

--------------------------------------------------
Rise to the top 3% as a developer or hire one of them at Toptal: https://topt.al/25cXVn
--------------------------------------------------

Music by Eric Matyas
https://www.soundimage.org
Track title: Mysterious Puzzle

--

Chapters
00:00 Extract A Few Members From Tar Archive And Pipe Through Network
00:34 Accepted Answer Score 15
01:11 Thank you

--

Full question
https://superuser.com/questions/329751/e...

--

Content licensed under CC BY-SA
https://meta.stackexchange.com/help/lice...

--

Tags
#tar #pipe #cpio

#avk47



ACCEPTED ANSWER

Score 15


tar -xzOf file.tar.gz file_you_want_to_extract | ssh user@host 'cat > /path/to/destination_file'
  • -x : Extract
  • -z : Through gzip
  • -f : Take in a file as the input.
  • -O : Extract to stdout

The file_you_want_to_extract is extracted from file.tar.gz to the standard output, piped into ssh, which runs cat on the remote host and writes its standard in to the remote destination_file. Of course, you'll want to ensure you have write permission to your desired destination file on the remote host.