Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'm resurrecting this thread because I've been looking for the same kind of solution, and I've found one that works for me. It's a minor modification to a suggestion from <a href="http://osxdaily.com/2011/05/05/transfer-clipboard-text-source-code-between-macs-with-ssh/" rel="noreferrer">OSX Daily</a>.</p> <p>In my case, I use Terminal on my local OSX machine to connect to a linux server via SSH. Like the OP, I wanted to be able to transfer small bits of text from terminal to my local clipboard, using only the keyboard. </p> <p>The essence of the solution: </p> <pre><code>commandThatMakesOutput | ssh desktop pbcopy </code></pre> <p>When run in an ssh session to a remote computer, this command takes the output of <em>commandThatMakesOutput</em> (e.g. ls, pwd) and pipes the output to the clipboard of the local computer (the name or IP of "desktop"). In other words, it uses nested ssh: you're connected to the remote computer via one ssh session, you execute the command there, and the remote computer connects to your desktop via a different ssh session and puts the text to your clipboard.</p> <p>It requires your desktop to be configured as an ssh server (which I leave to you and google). It's much easier if you've set up ssh keys to facilitate fast ssh usage, preferably using a per-session passphrase, or whatever your security needs require.</p> <p>Other examples:</p> <pre><code>ls | ssh desktopIpAddress pbcopy pwd | ssh desktopIpAddress pbcopy </code></pre> <p>For convenience, I've created a bash file to shorten the text required after the pipe:</p> <pre><code>#!/bin/bash ssh desktop pbcopy </code></pre> <p>In my case, i'm using a specially named key</p> <p>I saved it with the file name <em>cb</em> (my mnemonic (ClipBoard). Put the script somewhere in your path, make it executable and voila:</p> <pre><code>ls | cb </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload