λ!

A blog about all things code

Copying in the terminal

xclip is a useful tool to copy output from the terminal directly to your clipboard. It’s typical usage is as follows:

$ echo "Hello, world" | xclip -selection clipboard

I’ve put this in an alias to save some precious keystrokes:

$ alias cclip='xclip -selection clipboard'
$ echo "Hello, world" | cclip

Tags: Linux

Related: Debugging cron with `env`