Find the answer to your Linux question:
Results 1 to 3 of 3
I use red hat linux. I have two linux server . I want to use tar over ssh to tar and untar the file. The server A , have IP ...
  1. #1
    Just Joined!
    Join Date
    Aug 2009
    Posts
    44

    tar/untar over ssh

    I use red hat linux.
    I have two linux server .
    I want to use tar over ssh to tar and untar the file.

    The server A , have IP 10.1.1.a ,there is dir a and contain files.
    The server B have IP 10.1.1.b , there is dir b and contain file .

    So, in above case ,how can I tar over ssh sunc that the file in dir a , server a can tar to server b ,dir b .
    and if I use untar over ssh ,if the tar ball in server b , dir b ,say b.tar , how can I extract it to server a ,dir a over ssh ???

    Please advice in detailed command .

  2. #2
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    Location
    3rd rock from sun - Often seen near moon
    Posts
    1,568
    I would recommend using sshfs and then perform these operations . How to: Mount Remote Directories using sshfs | Linuxers
    - Lakshmipathi.G
    -------------------
    FOSS India Award winning ext3fs Undelete tool and tutorials www.giis.co.in
    First they criticize you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    -------------------

  3. #3
    Just Joined!
    Join Date
    Sep 2011
    Posts
    19
    I do this all the time to copy directory trees between hosts while preserving various permissions and file attributes. It is also much faster than SCP:

    cd /lib/modules && tar cpzs `uname -r` | ssh user@host 'cd /lib/modules && tar xzvps'

    Using the double-& forces the command to fail if I typo the directory. Of course you probably don't care about preserving access times and userids for your modules directory, but I thought it is reasonable example.

    Also, I like to put the 'v' on the remote side, so when something is being extracted I know the remote site is getting it and is not just buffering in standard I/O.

    -- Eric

Posting Permissions

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