Linux – “Stream” tar action from remote server through Putty

linuxputtysshtar

I am accessing a shared hosting account through Putty / SSH.
The account is pretty full, 300 MB below its quota.
I need to make a full backup of all data present on the account. Creating a bzip2 file using

tar cjf archive.tar.bz2 directory/* 

fails because there is not enough space for the tar.

Does anybody know a way to create a tar file and "stream" it to a local file on my PC? Through putty or any other SSH tool?

Best Answer

If you have cygwin, then you can just run something like this on your local machine:

ssh user@host 'tar cj directory' > /cygdrive/c/archive.tar.bz2

and it will put the tar archive in c:\archive.tar.bz2

If you don't have cygwin, you can do the same thing with plink (part of PuTTY) from a command window;

plink user@host 'tar cj directory' > c:\archive.tar.bz2

(I'm assuming you're on Windows if you're using PuTTY - if you're on Linux, just run the ssh command)

Related Topic