Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I'd like to basically pipe a wget command to a file on a remote server over SSH. How can I do this? I know I could simply ssh into the server and have it download the file, but I'd much rather use the local machine to download it and send it.

share|improve this question

1 Answer 1

up vote 18 down vote accepted

If I understand your question correctly (it's not clear what machine is supposed to do what), you are logged into some machine myclient, you have ssh access to another machine myserver, and you want to download a file over HTTP from a remove server www.example.com, with the requirement that the HTTP download must be performed to myclient but the data needs to be saved on myserver. Then:

wget -O - http://www.example.com/whatever | ssh myserver 'cat >/path/to/remote/destination'

Another approach is to mount the remote server's filesystem over SSH, with sshfs. This is too much hassle for a once-off need, but convenient if you do that sort of things often.

mkdir ~/myserver
sshfs myserver:/ ~/myserver
wget -O ~/myserver/path/to/remote/destination http://www.example.com/whatever
share|improve this answer
Yeah, that's exactly what I wanted to do. I needed to run the actual HTTP download on A, but copy the file over SSH to B without actually storing the file on A. Win! –  Naftuli Tzvi Kay Mar 10 '11 at 20:30

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.