this post is from my old, first website, dated 2011-08-10. It’s the one I most refer back too.
The usual way is to pull data. This is often more secure. Say you have a web server and a file server for backup. The backup server is likely more trustworthy than the web server. You don’t want to be typing your backup server password on a possibly compromised web server. So from the backup server, you type:
ssh email@example.com tar cvf - some-folder >some-folder.tar
The dash tells tar to use standard output for the -f option. The redirection to some-folder.tar is interpreted by the local shell.
But sometimes, you are working on a server, already logged in, and you consider the server secure. Say a virtual host system. You want to run a program and send the output to another machine, a backup server or another virtual host, without leaving an intermediate file laying around. This is slightly more obscure: