I ssh into my VPS and run tmux. I can copy/paste from the remote to local, and local to remote – using the mouse and shift.

But I don’t know how to copy large quantities of text.

If I were working locally, I could do this:

cat somefile.txt | xsel -b
cat somefile | xclip -selection clipboard
to copy into the clipboard. (I can’t do that of course as the remote server doesn’t run x, and even so the clipboard would not match the one used in tmux.)

So, how do I copy text in the tmux session, and for it to be duplicated over the wire to my local system’s clipboard?

Actually, this is applicable even without tmux – how to copy-paste large buffers between a remote and local shell.