Thanks to http://www.contentwithstyle.co.uk/content/4-ssh-config-tips-for-faster-remote-working/ I can avoid creating files which need to be scp’d: I can pipe the content directly:
local$ cat localfile.txt | ssh remote "cat - >> remotefile.txt"
For this to work, I have already got “remote” set up in my
~/.ssh/config. You can get much more involved in this:
My favourite example from the last site (execute commands on remote server but save the output to local) is:
ssh firstname.lastname@example.org "mysqldump -u DB_username -pDB_password DB_name | gzip -c" > /local/dir/DB_backup.gz