Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's 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.
Gpm provides mouse support to text-based Linux applications like the Emacs editor and the Midnight Commander file management system. Gpm also provides console cut-and-paste operations using the mouse and includes a program to allow pop-up menus to appear at the click of a mouse button.
I'm okay with using the mouse to copy-paste from a terminal, but because the terminal might interpret characters differently I wanted to by-pass it completely, sort of like redirecting output to the clipboard. I guess there's no easy way to do this, otherwise google would have found something by now...
Because you have not really explained your situation (what you'd like to be able to do, with what processes / commands ), I think I do not really understand your question.
If you are in a terminal, you can redirect "output" from one process to the "input" of another with the pipe "|" symbol. Eg mount | grep sda
For all the gory details of redirection and piping, please see man bash
I'm familiar with redirection, the example I give in my first post is pretty straight-forward: I'm wondering if there is some series of shell commands that will allow me to easily redirect output to the clipboard.
i.e. say I have some text "bar" in file "foo.txt". Currently inorder to get these contents into the copy buffer I need to do something like "cat foo.txt" then copy-paste the console output. This is both tedious and prone to error as I discovered with certain non-ASCII data. So what I'd like to be able to do instead is directly insert something into the copy-buffer. The only solution I've found to do this is xclip, so I'm wondering if there are any, more native, alternatives.
I'm wondering if there is some series of shell commands that will allow me to easily redirect output to the clipboard.
Which "clipboard" ?
AFAIK "the shell" has no concept of "clipboard". There may be "copy buffers" in applications like vi and emacs, but I don't think this is what you are looking for. Otherwise, gpm is pretty good.
"Clipboards" are a GUI concept. How they handle them depends on the GUI you are running, but you are asking for shell commands.
Yep, that makes sense, but like you can control the GUI via the shell (i.e. startx, system-config-display, etc.), was wondering if there was such a command to control GNOME's 'clipboard'.
Can you give an example of what you can't do; without posting "cat foo.txt > clipboard". What do you intend to do with what winds up in the clipboard?
The most classic example that I can come up with is how to copy text from a browser screen to a gnome terminal. In the browser, merely highlight and CTL-C, and in the terminal use "ALT-P". But, as others mentioned, this is a function of the gnome-terminal.
To be honest, the idea came from these forums when I wanted to post the output of various logs in pastebin. Gedit garbled some of them and high-lighting from the console seemed primitive, I just thought there would be a better way, like "cat foo.log > clipboard", go to pastebin, ctrl+v.
Well ... to make a long story short: no, there's no way to
avoid those extra utilities. There's no "device node" for
the x-clipboard, or a pipe ... feel free to use the source
of xclip to make one ;}
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.