You want to transfer a big directory to some remote machine. Since it takes time to transfer it, you want to compress it and then send it over. However, you dont’t have so much space in the local machine to store the compressed image of the directory. Here is what you can do:
tar -zcvf – <dirname> | ssh user@remotehost “cd <directory> && tar zxvf -“
What you are essentially doing is compressing the directory and sending it directly to the remote machine instead of storing it locally through piping. Note that you will have to put the && in quotes otherwise the local bash shell will eat it instead of sending it to the remote bash shell.