10

I need to copy text on the first PC and paste on the second. Is this possible?

unor
  • 548

4 Answers4

9

If the PCs are on the same network, it is possible. Software like Synergy can do it.

Synergy brings your devices together in one cohesive experience.

  • Seamlessly move your mouse to any computer and start typing.
  • Works on all major operating systems (Windows, Mac OS X, and Linux).
  • Share your clipboard (copy and paste) between your computers.
jonvon
  • 118
4

(For most cases, synergy will be more useful than this - see @jonvon's answer.)

There is a more low-level solution similar to synergy - it's called x2x - like "X to X", joining two X screens together.

With two X displays, it can make the mouse switch to the other display when it touches the edge of the screen that is next to the other screen, which feels like it's just one mouse pointer on one big screen - while it actually moved to another computer, and switched over the keyboard control too.

For the task at hand, x2x shares the X selection between the two computers. When used with windows, it interacts with the clipboard.

It is available as the package x2x in Ubuntu, but there is also a Cygwin build, available from the cygwin setup. The cygwin version allows to connect to a Windows screen, without running X there.

For options, see man x2x.
(Make sure you use one of the options like -west - that activates the more interesting mode of operation.)

Volker Siegel
  • 13,065
  • 5
  • 49
  • 65
  • 1
    Thank you, it is interesting for testing. But already now with Synergy no one will guess that my second monitor not connected to the same PC :) – Vitaly Zdanevich Aug 21 '14 at 13:59
  • @VitalyZdanevich Yeah, I know this fascination :) I remember when I first used x2x - I was working remote on both screens. When going to the other screen, the mouse pointer effectively went from Hongkong to Sweden. Via Germany. – Volker Siegel Aug 21 '14 at 15:18
  • This might be useful when using x2x: https://askubuntu.com/a/167591/75050 – fuenfundachtzig Mar 30 '20 at 15:06
3

You can interact with the X clipboard (and the promary selection) using xclip. The specific task in your question, paste text that was copied elsewhere, requires to copy over the clipboard contents.
You can use ssh to pipe the text from one clipboard to the other. That works best with password-less ssh login of course:

After copying on on firstPc, you run on secondPc:

$ ssh firstPc 'DISPLAY=:0 xclip -o -selection clipboard' | xclip -i  -selection clipboard

Now, you can paste on secondPc.

Note that a clipboard can not only contain text, but also more structured data. It can even contain the same data in multiple formats.

Volker Siegel
  • 13,065
  • 5
  • 49
  • 65
  • 1
    I got much more with Synergy - my mouse in two PC! But thank you for answer. – Vitaly Zdanevich Aug 21 '14 at 10:01
  • 1
    Sure, I guessed the synergy answer is more useful for you - but there may be later reader interested in this, as it matches the question text pretty well. Said that, you reminded me that I know another solution, more similar to synergy; It's somewhat in between, you will still use synergy. – Volker Siegel Aug 21 '14 at 10:18
1

You could also use this neat little online clipboard called IP-Share. I found it very useful when you want to copy/paste small text and/or files between computers or mobile devices within the same network!