xclip is a useful tool to copy and paste textual content between the shell and GUI (X11) programs.

  • Installing it is easy:
$ sudo apt install xclip
  • To copy output from shell to X11 clipboard:
$ pwd | xclip
  • To paste from X11 clipboard to shell:
$ xclip -o | ls
  • To copy from Vim to clipboard: Visually mark the content and press : followed by !xclip -f. The -f option makes it suck in and spit back the content. This is required in Vim else the stuff you marked is gone!😀

  • To paste from clipboard to Vim: :read !xclip -o

Tried with: XClip 0.12 and Ubuntu 14.04

Leave a Reply

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