Dont Have Enough Space?

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@remotehostcd <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.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s