linux command to copy text to clipboard


Install xclip

sudo apt-get install xclip

Copy a string to clipboard

echo -n 'I will be copied to the clipboard!' | xclip -selection c

Use Control+Shift+V to paste the copied string to terminal!

Copy texts from a file to clipboard

xclip -in -selection c <filename>

Paste clipboard contents to a file

xclip -out -selection c <filename>

:)

Ref: http://linuxtidbits.wordpress.com/2008/02/22/command-line-to-clipboard/

About these ads

2 thoughts on “linux command to copy text to clipboard

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