Tuesday, April 8, 2008

Copy and Paste between Windows and Linux

Many people use Windows as primary working machine and login to remote Linux/Unix (we will use Linux as shorthand afterwards) boxes. There are times when we need to copy and paste information between Windows and Linux. Below we are going to discuss convenient ways to do so.

Tools

PuTTY and Xming are two popular programs to run in Windows host to facilitate communication to Linux. PuTTY provides console connection while Xming X Window connection. For Xming, Ensure you start Xming with parameter -clipboard (which is enabled by default). Our discussion below is focused on how to copy/paste within PuTTY/Xming. Copy/paste for other Windows applications is quite general (Ctrl+C and Ctrl+V) and should be familiar to the reader, therefore omitted.

Ways

PuTTY

Copy to clipboard: click-and-drag to highlight. Just select, no need to press any key.

Paste from clipboard: right mouse button.

Xming

For Xming applications, copy/paste follows the X window standard as discussed below.

Copy to clipboard: click-and-drag to highlight. Same as PuTTY.

Paste from clipboard: middle mouse button.

2 comments:

  1. Is there any way I can turn this behavior off? I use cygwin/X to access Solaris applications from my Windows box, and the copy-on-select behavior is a real pain. My usual pattern is

    . Select source text
    . Right-click/Copy (or Ctrl-C)
    . Select text to be pasted over
    . Right-click/Paste (or Ctrl-V)

    Of course the third step puts the replaced text in my Windows clipboard. Wackiness ensues.

    I just discovered MingW and will switch if it has a way to make the clipboard more consistent with Windows.

    ReplyDelete
  2. @isaac32767: my understanding is that copy-on-select is the standard X window way so there might not be ways to turn it off. As a work around, maybe you can try ClipX, as discussed here. ClipX enabled multiple items in Windows clipboard. Note that I have not tried this software myself, so my suggestion is only for your reference.

    ReplyDelete