Magic command of tar

If we want to send a large file to a remote host, we first compress (using tar cvzf’) the file then send (using scp) that file to the remote host and then uncompress (using tar xzvf) the file to view. so this is lengthy and time consuming.

If we use the following single line command it will reduce time to a significant amount ( take only 1/3 time of the above procedure).

  tar czvf - <File-U-Want-to-tar> | ssh tarique@192.168.6.5  "cat | tar xvzf -"

OR

  tar czvf - <file-u-want-to-tar> | (ssh tarique@192.168.6.5 tar xvzf -)
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


%d bloggers like this: