Go Back   TechArena Community > Software > Operating Systems
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



How to utilize tar and untar over SSH in red hat linux

Operating Systems


Reply
 
Thread Tools Search this Thread
  #1  
Old 15-09-2011
Member
 
Join Date: Aug 2011
Posts: 60
How to utilize tar and untar over SSH in red hat linux
  

Hi, I have installed red hat linux in my machine but as I am newer to this operating sysmte I dont know about the feature and functioning about the operating system and have some doubt regarding that.

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.

Reply With Quote
  #2  
Old 15-09-2011
Member
 
Join Date: Nov 2009
Posts: 1,416
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.
  • ar
  • basename
  • cd
  • chown
  • cpio
  • csh
  • dirname
  • ls
  • mt
  • pack
  • pax
  • setfacl
  • umask
  • zcat
Reply With Quote
  #3  
Old 15-09-2011
Member
 
Join Date: Nov 2009
Posts: 1,292
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
Reply With Quote
  #4  
Old 15-09-2011
Member
 
Join Date: Nov 2009
Posts: 1,269
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 -)
Reply With Quote
  #5  
Old 15-09-2011
Member
 
Join Date: Nov 2008
Posts: 1,185
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 -
Reply With Quote
  #6  
Old 16-09-2011
Member
 
Join Date: Aug 2011
Posts: 60
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 didnt, why so?
Reply With Quote
Reply

  TechArena Community > Software > Operating Systems
Tags: , , , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to utilize tar and untar over SSH in red hat linux"
Thread Thread Starter Forum Replies Last Post
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
Windows 7 Ultimate does not utilize all the RAM Kaufman Operating Systems 5 21-03-2010 02:06 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


All times are GMT +5.5. The time now is 12:50 AM.