Operating System - HP-UX
1752806 Members
6567 Online
108789 Solutions
New Discussion

Re: How to unzip and untar xyz.tar.gz file from one hpux server to another remote hpux server

 
MRaghu
Visitor

How to unzip and untar xyz.tar.gz file from one hpux server to another remote hpux server

I have created tar.gz from below mentioned command 

$cd  /abc

$tar  cvf - abc | gzip > abc.tar.gz 

now i need to unzip and untar this file to remote server. 

Kindly provide the single command throgh i can unzip and untar together on remote hp ux server.

3 REPLIES 3
Steven Schweda
Honored Contributor

Re: How to unzip and untar xyz.tar.gz file from one hpux server to another remote hpux server

> [...] hpux server [...]

      uname -a

> now i need to unzip and untar this file to remote server.

   How did you intend to get logged into the "remote server?  rsh?  ssh?
Other?  How did you intend to transfer the ".tar.gz" file to the "remote
server"?  FTP?  NFS?  rcp?  scp?  Other?

   After you transfer the file to the remote system, you could, on the
"remote server", use a command like:

      gzip -cd abc.tar.gz | tar xf -

   Rather than create "abc.tar.gz", you could do everything in one
command pipeline like the following:

      tar cf - abc | \
       rsh remote_host ' ( cd <dest_dir> ; gzip -cd - | tar xf - )  '

   A Web search for terms like, say:

      tar  pipeline

should find many examples and refinements.

MRaghu
Visitor

Re: How to unzip and untar xyz.tar.gz file from one hpux server to another remote hpux server

Hello  Steven Schweda, 

Thanks for reply..  but my query is that i have backup file abc.tar.gz on one server and i want to transfer, unzip and untar it on another hpux server. because i have limited disk space that i want this solution in one step. 

Is there any single command that will transfer, unzip and untar in single command.

Steven Schweda
Honored Contributor

Re: How to unzip and untar xyz.tar.gz file from one hpux server to another remote hpux server

> Is there any single command that will transfer, unzip and untar in
> single command.

   "transfer" how?

> How did you intend to get logged into the "remote server?  rsh?  ssh?
> Other?  How did you intend to transfer the ".tar.gz" file to the "remote
> server"?  FTP?  NFS?  rcp?  scp?  Other?

   Still wondering.  Do you ever answer questions, or do you only ask
more?  (Or the same ones again?)

>       tar cf - abc | \

I somehow omitted the "gzip" part of that.  Perhaps better:

      tar cf - abc | gzip -c | \

>    A Web search for terms like, say:
>
>       tar  pipeline
>
> should find many examples and refinements.

   Still true.

   A more general form:

      ( cd <src_dir> ; tar cf - <src> | gzip -c ) | \
       rsh <remote_host> ' ( cd <dest_dir> ; gzip -cd - | tar xf - ) '

> [...] i have backup file abc.tar.gz on one server [...]

   So, change the first line to:

      cat abc.tar.gz | \

> [...] i have limited disk space [...]

   That's why making "abc.tar.gz" is a poor idea, when you can do
everything in one pipeline without saving the intermediate data in a
file anywhere.  (See "A more general form", above.)

   Instead of "rsh", you could use "ssh".  Whichever works between your
systems.