Copying Output of Commands in a Linux Terminal to X Selection or Clipboard

xclip is a tool to copy the copy the output of commands from a command line in a terminal to X selection or clipboard. It connects the command line interface and the X selections (clipboard) and is a very useful tool. For example, processing some text in vim in a terminal and then copying it to the browser will be easily handled by xclip.

There are lots good documents and tutorials on the Web including xclip man page, this tutorial and this one. I just give two very common use cases with the command examples. Make sure you have already installed it. On Fedora Linux, you can install it by # yum install xclip.

Please share if you like this post:

About Eric Zhiqiang Ma

287 articles and counting.

Eric Zhiqiang Ma is interested in operating systems and distributed computing and processing systems. Find Eric on Facebook, Twitter, LinkedIn and Google+. The views or opinions expressed here are solely Eric's own and do not necessarily represent those of any third parties.