Admin-Ahead Community

Linux => General Linux => Topic started by: rohitj on October 26, 2013, 12:20:53 pm

Title: Use tar Command Through Network Over SSH Session
Post by: rohitj on October 26, 2013, 12:20:53 pm
Use tar Command Through Network Over SSH Session


In order to increase the transferring speed and time consuming, We can use tar command over SSH in order to transfer data from one server to another instead of SCP.As the files will be in a compressed format, the data transferring will complete faster than SCP.

In order to transfer a folder, please execute the below command.

===============
tar zcvf - wordpress | ssh root@192.168.*.* "cat > /home/word.tar.gz"
===============


For example:

============
tar zcvf - wordpress | ssh root@192.168.*.* "cat > /home/word.tar.gz"
wordpress/wp-admin/user-edit.php                                                                                                                                                               
wordpress/wp-admin/network.php 
......
...
.
Password:
===========

After that you can restore the data by login to the destination server use "tar -zxvf filname.tar.gz" or you can restore it via SSH too.

=========
ssh root@192.168.*.* "cat /home/word.tar.gz" | tar zxvf -
=========

 ;)