I sometimes run a command like this to set the system clipboard, because I want to paste the result of whatevercommand into a text editor, terminal, or whatnot.

whatevercommand | xclip -selection c

But this uses the X clipboard, and if I'm on a remote system with no X, this won't work. Instead I often use tmux on remote systems.

So is there a similar command that I can use to set tmux's clipboard?

I'm thinking something like:

whatevercommand | tmux set-clipboard
echo aaaaaaaaaaaaaaaaa|tmux load-buffer -
  • Thanks! That was what I meant. Unfortunately I didn't think enough before asking, because I realized that what I actually wanted to do this time was to copy/paste between remote connections, where the remote machine is not running tmux. Oh well, that's another question maybe. – Martin Vilcans Aug 22 '19 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.