Linux - GeneralThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.