1

I have two server (LOCAL) 192.168.1.1 and (REMOTE) 192.168.15.2

I want to untar a file from LOCAL (192.168.1.1) on REMOTE (192.168.15.2) via an SSH connection. What command can I use for that?

source path: /home/user/example.tar.gz

target path: /mnt/untar/extracted_folder

4

On the source system (LOCAL):

ssh -e none 192.168.15.2 'tar -xzf - -C /mnt/untar/' </home/user/example.tar.gz
  • bash: /home/user/example.tar.gz: No such file or directory i m getting this error – Amrut Nadgiri Aug 23 '17 at 7:34
  • 2
    @AmrutNadgiri And what shall I do about it if you say the file is there but it isn't? – Hauke Laging Aug 23 '17 at 8:37
0

Try this

ssh root@host1 "cd /dir/tocopy/ && tar -cf - ." | \
ssh root@host2 "cd /dir/tocopyto/ && tar -xf -"

NJOY

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.