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

2 Answers 2

4

On the source system (LOCAL):

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

Try this

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

NJOY

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.