Results 1 to 6 of 6

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

  1. #1
    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.

  2. #2
    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

  3. #3
    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

  4. #4
    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 -)

  5. #5
    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 -

  6. #6
    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?

Similar Threads

  1. How can I utilize a 95 watt cpu in a 95 max tdp MB
    By Lucretia in forum Motherboard Processor & RAM
    Replies: 5
    Last Post: 26-11-2010, 11:14 PM
  2. How to utilize iHaxGamez
    By LoknathT in forum Windows Software
    Replies: 6
    Last Post: 23-10-2010, 03:54 AM
  3. Windows 7 Ultimate does not utilize all the RAM
    By Kaufman in forum Operating Systems
    Replies: 5
    Last Post: 21-03-2010, 02:06 AM
  4. How to utilize ipsec on a vpn network
    By Renau in forum Networking & Security
    Replies: 5
    Last Post: 02-03-2010, 08:14 AM
  5. To utilize mm keyboard under Linux
    By Elkanah in forum Operating Systems
    Replies: 4
    Last Post: 27-03-2009, 09:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •