Copy text from one terminal into another

If your terminal supports the zmodem protocol (KDE's Konsole does), and the remote system has the lrzsz package installed, you can trigger a direct transfer via the terminal using:

sz foo.txt

Konsole prompts you were to save the file and that's that. GNU screen apparently has zmodem support too.


The way to do that is to use an ordinary file or a named pipe.

Why not do the scp in the original terminal in the first place (even in the background)?

If the host system uses proc, in the second terminal do cd -P /proc/PID/cwd then do your scp from . (where PID is that of the shell which is in the cwd/pwd that you are interested in).