<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom"><title>Michael Jay Lissner</title><link href="https://michaeljaylissner.com/" rel="alternate"></link><link href="https://michaeljaylissner.com/feeds/tag/cli" rel="self"></link><id>https://michaeljaylissner.com/</id><updated>2008-08-28T20:47:05-07:00</updated><entry><title>Linux Tip - Route Standard Output Into to the Clipboard</title><link href="https://michaeljaylissner.com/posts/2008/08/28/linux-tip-route-standard-output-into-the-clipboard/" rel="alternate"></link><updated>2008-08-28T20:47:05-07:00</updated><author><name>Mike Lissner</name></author><id>tag:michaeljaylissner.com,2008-08-28:posts/2008/08/28/linux-tip-route-standard-output-into-the-clipboard/</id><summary type="html">&lt;p&gt;A friendly online stranger just taught me how to do something that has been plaguing me for some time. Ever since I learned how to use pipes in the unix commandline, I have wanted to know how to pipe the output of a command into the system&amp;nbsp;clipboard.&lt;/p&gt;
&lt;p&gt;For example, the echo command simply repeats whatever you tell it to. So if I&amp;nbsp;run&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="nb"&gt;echo &lt;/span&gt;hello
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The computer will give me the&amp;nbsp;output &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;hello
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;By using a pipe (this symbol: |) I can route the output of one command into the input of&amp;nbsp;another. &lt;/p&gt;
&lt;p&gt;For example, if I&amp;nbsp;run: &lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="nb"&gt;echo &lt;/span&gt;hello | helloprogram
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;The helloprogram will receive the value of &amp;#8216;hello&amp;#8217; as an input, and will do something with it. This allows stringing together small commands into long ones, which sometimes is incredibly&amp;nbsp;handy. &lt;/p&gt;
&lt;p&gt;Anyway, if you want to route standard output into the system clipboard, you will need to install an application called xclip. Once that is installed, a command such&amp;nbsp;as:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre&gt;&lt;span class="nb"&gt;echo &lt;/span&gt;hello | xclip -i -selection clipboard
&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;Will put the word hello into the clipboard. Ctrl + V will then paste that 
value into whatever application&amp;nbsp;desired.&lt;/p&gt;
&lt;p&gt;Thanks to aaron at &lt;a href="http://www.cyberciti.biz/faq/linux-copying-with-middle-mouse-button/#comment-38676"&gt;http://www.cyberciti.biz/faq/linux-copying-with-middle-mouse-button/#comment-38676&lt;/a&gt; for help with this&amp;nbsp;question.&lt;/p&gt;</summary><category term="Linux"></category><category term="CLI"></category></entry></feed>