Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

The command below extracts the specified file in a remote machine:

tar -xzOf file.tar.gz file_you_want_to_extract | ssh user@host 'cat > /path/to/destination_file'

My requirement is that I want to extract all the files in to the remote machine. How can i achieve this ?

tar -xzOf file.tar.gz | ssh user@host 'cat > /path_dir'

All the files in file.tar.gz should be extracted in the remote host in /path_dir .

share|improve this question
cat myfile.tgz | ssh user@host "tar xzf - -C /some/dir"
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .