|
| ||||||||||
| Tags: how to, linux, redhat, ssh, tar file |
![]() |
| | Thread Tools | Search this Thread |
|
#1
| |||
| |||
| How to utilize tar and untar over SSH in red hat linux
Actually the thing is like I have two linux server and I want to exercise tar over ssh to tar and untar the file. The server A uses IP 10.1.1.a there is directory “A” which contain files. The server B uses IP 10.1.1.b , and here also dir ”b” contain file . So, in above case, how can I tar over ssh in such way that the file in directory “a”, server a can tar to server b ,directory “b” . Please help me with the situation. |
|
#2
| ||||
| ||||
| Re: How to utilize tar and untar over SSH in red hat linux
First of all let me tell you as I am not getting whatever you have mentioned in the problem sectioned but still as far as commands are concern I would like to tell you about them so that you can make use of them.
|
|
#3
| |||
| |||
| Re: How to utilize tar and untar over SSH in red hat linux
See I am hoping that you are asking about opening the tar files and untar it again, thus for that I would like to tell you about the command lines that actually uses. For tar: tar -pczf filename.tar.gz www/ for untar tar xvfz filename.tar.gz |
|
#4
| |||
| |||
| Re: How to utilize tar and untar over SSH in red hat linux
I am not sure about this but still as idea of tarring over ssh you can use the below mentioned command line: Code: ssh user@srcbox 'tar cf - srcpath' | tar xf - trgt or simply you can have see another example as well. To copy SOURCEDIR into DESTDIR localhost% tar zcvf - SOURCEDIR | (cd DESTDIR; tar zxvf -) |
|
#5
| ||||
| ||||
| Re: How to utilize tar and untar over SSH in red hat linux
I am hoping that you must be thinking of actually copy whole trees from one location to another and for that There are basically 2 methods, PUSH & PULL. You can refer the below mentioned examples. -------------Pushing a directory from local host to remote host 1. tar & ssh 1 - copy SOURCEDIR from localhost to remotehost over ssh. Untarring begins in /home/user1 localhost% tar zcvf - SOURCEDIR | ssh user1@remotehost tar zxvf - 2 - copy SOURCEDIR from localhost to remotehost over ssh. Untarring in DESTDIR 1 localhost% tar zcvf - SOURCEDIR | ssh user1@remotehost 'cd DESTDIR; tar zxvf - ' 2 localhost% tar zcvf - SOURCEDIR | ssh user1@remotehost "(cd DESTDIR; tar zxvf -)" 3 localhost% tar zcvf - SOURCEDIR | ssh -l user1 remotehost 'cd DESTDIR ; tar zxvf -' 4 localhost% tar zcvf - SOURCEDIR | ssh user1@remotehost "cat > /DESTDIR/DESTFILE.tar.gz" ------------- Pulling a directory to localhost <— remotehost copy SOURCEDIR to DESTDIR 1 localhost% ssh remotehost 'tar zcvf - SOURCEDIR' | tar zxvf - 2 localhost% ssh -n remotehost 'tar zcvf - SOURCEDIR' | tar zxvf - 3 localhost% ssh remotehost "( cd SOURCEDIR ; tar zcvf - SOURCEFILES ) " | tar zxvf - |
|
#6
| |||
| |||
| Re: How to utilize tar and untar over SSH in red hat linux
Hey thanks for the suggestion, I have tried this and some of them works perfectly but some of them didn’t, why so? |
![]() |
|
| Thread Tools | Search this Thread |
| |
Similar Threads for: "How to utilize tar and untar over SSH in red hat linux" | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How do you utilize your 5GHz band? | Chung Ae | Networking & Security | 3 | 03-10-2011 03:33 AM |
| How can I utilize a 95 watt cpu in a 95 max tdp MB | Lucretia | Motherboard Processor & RAM | 5 | 26-11-2010 11:14 PM |
| How to utilize iHaxGamez | LoknathT | Windows Software | 6 | 23-10-2010 03:54 AM |
| How to utilize ipsec on a vpn network | Renau | Networking & Security | 5 | 02-03-2010 08:14 AM |
| To utilize mm keyboard under Linux | Elkanah | Operating Systems | 4 | 27-03-2009 09:23 AM |