I have an archive I need to transfer to a remote destination but the target drive is not big enough to hold both the compressed archive and the uncompressed files.

I wonder if there are some utilities which can decompress the archive as the data arrives, rather than having to receive the whole thing then decompress it.

netcat is what seems to show up in my searches but I am open to any alternatives.


1 Answer 1


On the sending side:

dd if=somefile.gz bs=32M |nc server 7000

On the receiving side:

nc -l -p 7000 | gzip -dfc|dd bs=32M of=somefile

or if it is a tar.gz

nc -l -p 7000 | gzip -dfc|tar -xvf -
  • I am trying to execute if over a secure connection via SSH. I first create a tunnel - ssh root@remote -L 7000:localhost:7000. But after I try to send via dd if=/archives/file.gz bs=32M | nc localhost 7000 on the local side, an error appera channel 3: open failed: connect failed: Connection refused. Any idea what it could be. I am doing some searching anyway
    – vfclists
    Oct 19, 2012 at 17:12
  • You have to first establish the receiving side and then the sender.
    – Stone
    Oct 19, 2012 at 19:45

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.