Differences

This shows you the differences between two versions of the page.

Link to this comparison view

wiki:infrastructure_tools:ssh:ssh-tar [2014/02/01 22:39] (current)
Line 1: Line 1:
 +====== SSH - Tar ======
 +
 +===== Preface =====
 +
 +Some time you will need to copy a file between SSH Serer and SSH Client. It is possible to use standard “scp”. On another hand sometime it is handy to know as well about another possibilities. In this document I would like to describe the possibility to use SSH and TAR to compress the file at the same time as it will be transferred between SSH Client and SSH Server.
 +
 +=====   =====
 +
 +===== SSH Client ->​copy->​ SSH Server =====
 +
 +Example
 +
 +<​code>​
 +[user@SSH_Client ~]$ ls                                                                                   # We would like to copy this file
 +source_file
 +
 +[user@SSH_Client ~]$ tar cvzf - source_file | ssh user@SSH_Server "​cat>​ ~/​destination_file.tar.gz" ​       # Copy & Compress file
 +source_file
 +user@ssh_server'​s password:
 +[user@SSH_Client ~]$
 +
 +[user@SSH_Server ~]$ ls                                                                                   # We have created this file
 +destination_file.tar.gz
 +</​code>​
 +
 +<note tip>In this way you can copy a file and compress it in same time. In the case that you would like to extract the data it is possible to use “ tar –vxzf destination_file.tar.gz “</​note>​
 +===== SSH Server ->​copy->​ SSH Client =====
 +
 +Example
 +
 +<​code>​
 +[user@SSH_Server ~]$ ls                                                                                   # We would like to copy this file
 +source_file
 +
 +[user@SSH_Client ~]$ ssh user@SSH_Server "tar cvzf - source_file " | cat> ~/​destination_file.tar.gz ​      # Copy & Compress file
 +user@ssh_server'​s password:
 +source_file
 +[user@SSH_Client ~]$
 +
 +[user@SSH_Client ~]$ ls                                                                                   # We have created this file
 +destination_file.tar.gz
 +</​code>​
 +
 +<note tip>In this way you can copy a file and compress it in same time. In the case that you would like to extract the data it is possible to use “ tar –vxzf destination_file.tar.gz “</​note>​
  
Navigation
Print/export
QR Code
QR Code wiki:infrastructure_tools:ssh:ssh-tar (generated for current page)