yank: copy terminal text to clipboard

As the name suggests, yank is a tool to copy text. The usual way to copy from the terminal is to select the text and press <Ctrl-Shift-c>. yank is an alternative where you can pipe (or redirect) the output to yank (i.e., it reads from stdin) and then use keyboard shortcuts to move between output text and select the text you want.

It’s difficult to comment on where yank is a better in usability (than the traditional way) but it’s a cool alternative.

Installation

To install yank on Ubuntu, run:

$ sudo apt-get install xsel
$ git clone https://github.com/mptre/yank
$ cd yank
$ make
$ sudo make install

Usage

The animation above shows the usage well. Pipe the output to yank. The default keys to move between text are <Ctrl-n> and <Ctrl-p> and the only way to change those is by editing the code directly.

yank man page comes with a number of examples to explain the several use cases. Run:

$ man yank

Comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s