6

How to paste text in a xterm? Now I can copy text from xterm to an outside application, like Firefox, by highlighting the text there. But I can not copy text from firefox to xterm. I am just normal user of Linux system and don't have root access to install patches. Is there any workaround?

System information is Linux version 2.6.18 (... @hs20-bc1-7.build.redhat.com)

One important fact I forgot to mention is that I'm using RealVNC to connect to the Linux server. Right-click works fine for prompt in my local Linux, but not the remote instance.

Jeff Schaller
  • 67,283
  • 35
  • 116
  • 255
Richard
  • 879
  • You'll need to tell us what you tried, and what didn't work. What did you click and type, and in what order? It is not acceptable to just tell us "I can not copy". –  May 18 '11 at 19:42
  • text is copied from firefox using 'copy' button as in rightclick menu. to paste, in my xterm, there is no menu with copy/paste button, so cant do this with mouse. tried shortcut key crtl+v and crtl+shift+v... neither not working.... –  May 18 '11 at 19:52

5 Answers5

5

To paste text copied from other windows (like you said firefox) in xterm window click the mouse wheel or center mouse button.

yasouser
  • 416
5

As noted by yasouser, middle-click is the standard way to paste the selection buffer in linux. This buffer gets written every time anything is selected with no need to initiate a copy command. In gtk based or influenced apps, there is usually a keybinding for this as well. Shift+Insert

In most Desktop Environments there is also a copy buffer that is separate from the selection buffer. Getting items into this usully requires a keyboard shortcut like Ctrl+C or menu selection, and pastes with Ctrl+V or a menu. These bindings are program specific and may varry, although they usually follow toolkit standards.

On KDE there is often a clipboard buffer configured by default in the tray that handles access to several recent clipboard items. This sort of function can be added to gnome and other environments as well.

Caleb
  • 70,105
0

Keep in mind that when you're pasting into your Xterm that if you're at the command prompt you could flood it with alot of 'junk'. You'll want to do something like this:

$ cat - >tmp.txt

This instructs the 'catenate' program to direct all of it's input into 'tmp.txt'. You'll paste your data in there and then enter ctrl-d which sends an 'end-of-file' to the cat program telling it to close its input. You'll get the command prompt back, and tmp.txt will contain what you pasted in.

Some window managers are 'rude' and start eating your clicks, but alot of the newer termals(gnome-terminal etc) have the standard 'Edit' menu.

0

You could try an X11 program like xcb to view what you have just selected. Unfortunately, things like Firefox and Chromium don't seem to follow whatever convention xcb uses, so it's not a complete solution.

0

Select/paste problems with Firefox are usually because it uses the clipboard rather than the X primary selection. xterm's behavior depends on the translations resource. You can see the select/paste definitions in the default key bindings in the manual page:

                Shift <KeyPress> Select:select-cursor-start() \
                                        select-cursor-end(SELECT, CUT_BUFFER0) \n\
                Shift <KeyPress> Insert:insert-selection(SELECT, CUT_BUFFER0) \n\
                   ~Ctrl ~Meta <Btn2Up>:insert-selection(SELECT, CUT_BUFFER0) \n\
                                <BtnUp>:select-end(SELECT, CUT_BUFFER0) \n\

It has a menu selection (and resource setting) "Select to Clipboard", which controls the behavior of its default translations resource, changing the meaning of SELECT to be either PRIMARY or CLIPBOARD.

That's non-standard, doesn't comply with the ICCM, but Firefox and its ancestor Netscape have ignored that for about 20 years. Not "modern" in the dictionary sense, of course.

Thomas Dickey
  • 76,765