Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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