LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 01-08-2009, 01:33 PM   #1
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438
Blog Entries: 5

Rep: Reputation: 32
cat into the clipboard?


Hi,

In command line mode, I paste highlighted text with the middle mouse button. This I gather is the contents of the clipboard. I'm pretty happy with that.

The problem is the copying before I paste ... I'm useless with the mouse you see, so I want to be able to write up a text file, save it and then "cat" it into the clipboard, so that way I can avoid mouse dragging, and be more accurate with stuff, cos I would have prepare dit beforehand.

Ideally I thought I could do a "cat mytextfile > clipboard".

Is such a thing possible (he hopes there's a special variable or device for the clipboard).

I use the word clipboard, but it might not be the right word. It's an MS word really. Hopefully though, some readers migth understand me.

Thanks!
 
Old 01-08-2009, 03:46 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
You can use either xsel or xclip for that. Either one can copy text to or from the clipboard or the copy buffer*. xsel has slightly better functionality and easier syntax. "cat textfile | xsel -i -b" will send the text to the clipboard, for example.



*The copy buffer is a separate function from the clipboard. The first uses only text highlighting and the middle mouse button, and is of a very temporary nature (actually, it's not even a buffer, it's a data transfer function that gathers and sends the highlighted text on demand). The clipboard is a separate function that is a little more persistent, and needs to be called with the cut, copy, and paste commands.

There are programs that can keep the two forms synchronized. KDE's klipper can do it, for example.
 
Old 01-09-2009, 05:51 AM   #3
stabu
Member
 
Registered: Mar 2004
Location: dublin IRL
Distribution: Slackv12.1, Slamd64v12.1,Xubuntu v8.10_64, FC8_64
Posts: 438

Original Poster
Blog Entries: 5

Rep: Reputation: 32
great stuff David, thanks for answer .. I hadn't really grokked this issue, but will head off now to google and go into more depth.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Clipboard manager Berticus Linux - Software 1 11-29-2006 12:34 AM
cat in asm/ cat --show-all option Tux Linux - Software 1 09-02-2006 09:31 PM
Persistent clipboard? Ander Linux - Newbie 3 05-05-2006 09:54 AM
Linux ClipBoard Sanctus Animus Programming 0 02-10-2004 08:33 PM
wine and Clipboard Y0jiMb0 Linux - Software 0 11-05-2003 03:39 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:16 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration