Skip to main content
added 5 characters in body
Source Link
slm
  • 380.1k
  • 127
  • 793
  • 897

I believe you could do something like this:

$ cat archive.tar.gz | ssh server2 "tar zxvf -"

If you need to control the directory where it gets extracted to on server2:

$ cat archive.tar.gz | ssh server2 "cd /path/to/dir; tar zxvf -"

Solaris

Given you're on Solaris your version of tar is likely to not include any of the compression features that GNU tar offers. Fear not you can still do this command, we just need to decompose the cat archive.tar.gz into a command that can first uncompress the tarball.

Something like this should do:

$ cat archive.tar.gz | ssh server2 "(cd /some/dir; gunzip | tar xf -)"

Or this:

$ gzip -dc < sample.tar.gz | ssh server2 "cd /path/to/dir; tar xvf -"

Or perhaps this:

$ gunzip sample.tar.gz | ssh server2 " cd /path/to/dir; tar xvf -"

But if you don't have gzip then you'll likely not have gunzip either.

I believe you could do something like this:

$ cat archive.tar.gz | ssh server2 "tar zxvf -"

If you need to control the directory where it gets extracted to on server2:

$ cat archive.tar.gz | ssh server2 "cd /path/to/dir; tar zxvf -"

Solaris

Given you're on Solaris your version of tar is likely to not include any of the compression features that GNU tar offers. Fear not you can still do this command, we just need to decompose the cat archive.tar.gz into a command that can first uncompress the tarball.

Something like this should do:

$ gzip -dc < sample.tar.gz | ssh server2 "cd /path/to/dir; tar xvf -"

Or perhaps this:

$ gunzip sample.tar.gz | ssh server2 " cd /path/to/dir; tar xvf -"

But if you don't have gzip then you'll likely not have gunzip either.

I believe you could do something like this:

$ cat archive.tar.gz | ssh server2 "tar zxvf -"

If you need to control the directory where it gets extracted to on server2:

$ cat archive.tar.gz | ssh server2 "cd /path/to/dir; tar zxvf -"

Solaris

Given you're on Solaris your version of tar is likely to not include any of the compression features that GNU tar offers. Fear not you can still do this command, we just need to decompose the cat archive.tar.gz into a command that can first uncompress the tarball.

Something like this should do:

$ cat archive.tar.gz | ssh server2 "(cd /some/dir; gunzip | tar xf -)"

Or this:

$ gzip -dc < sample.tar.gz | ssh server2 "cd /path/to/dir; tar xvf -"

Or this:

$ gunzip sample.tar.gz | ssh server2 " cd /path/to/dir; tar xvf -"
added 390 characters in body
Source Link
slm
  • 380.1k
  • 127
  • 793
  • 897

I believe you could do something like this:

$ cat archive.tar.gz | ssh server2 "tar zxvf -"

If you need to control the directory where it gets extracted to on server2:

$ cat archive.tar.gz | ssh server2 "cd /path/to/dir; tar zxvf -"

Solaris

Given you're on Solaris your version of tar is likely to not include any of the compression features that GNU tar offers. Fear not you can still do this command, we just need to decompose the cat archive.tar.gz into a command that can first uncompress the tarball.

Something like this should do:

$ gzip -dc < sample.tar.gz | ssh server2 "cd /path/to/dir; tar xvf -"

Or perhaps this:

$ gunzip sample.tar.gz | ssh server2 " cd /path/to/dir; tar xvf -"

But if you don't have gzip then you'll likely not have gunzip either.

I believe you could do something like this:

$ cat archive.tar.gz | ssh server2 "tar zxvf -"

If you need to control the directory where it gets extracted to on server2:

$ cat archive.tar.gz | ssh server2 "cd /path/to/dir; tar zxvf -"

I believe you could do something like this:

$ cat archive.tar.gz | ssh server2 "tar zxvf -"

If you need to control the directory where it gets extracted to on server2:

$ cat archive.tar.gz | ssh server2 "cd /path/to/dir; tar zxvf -"

Solaris

Given you're on Solaris your version of tar is likely to not include any of the compression features that GNU tar offers. Fear not you can still do this command, we just need to decompose the cat archive.tar.gz into a command that can first uncompress the tarball.

Something like this should do:

$ gzip -dc < sample.tar.gz | ssh server2 "cd /path/to/dir; tar xvf -"

Or perhaps this:

$ gunzip sample.tar.gz | ssh server2 " cd /path/to/dir; tar xvf -"

But if you don't have gzip then you'll likely not have gunzip either.

Source Link
slm
  • 380.1k
  • 127
  • 793
  • 897

I believe you could do something like this:

$ cat archive.tar.gz | ssh server2 "tar zxvf -"

If you need to control the directory where it gets extracted to on server2:

$ cat archive.tar.gz | ssh server2 "cd /path/to/dir; tar zxvf -"