LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   4MLinux (https://www.linuxquestions.org/questions/4mlinux-115/)
-   -   How to copy and paste from Terminal to other applications? (https://www.linuxquestions.org/questions/4mlinux-115/how-to-copy-and-paste-from-terminal-to-other-applications-4175558298/)

SansSg 11-08-2015 03:24 AM

How to copy and paste from Terminal to other applications?
 
Hi,

Is copy and paste from Terminal to other applications like Chrome or Leafpad supported? I tried a few ways (Ctrl-C, Ctrl-Insert, right-click, etc) but not working.

Thank you.

ondoho 11-08-2015 03:57 AM

yes, it is possible.
linux uses 2 clipboards, primary and secondary. simply highlighting the text copies to the primary clipboard. inside the terminal you canthen paste with 'Shift+Insert'. try it.
however, it doesn't carry over to your browser.
some terminal emulators have the additional 'Shift+Ctrl+C' (and '...+V') commands to use the secondary clipboard.
what terminal emulator are you using?

jamison20000e 11-08-2015 04:31 AM

Hi.

GUI? Otherwise:
Code:

man xsel
and\or:
Code:

man xclip
&c... :)

Edit\add: Oh, install GPM... ;)
https://www.virtualbox.org/attachmen...10914/VM01.PNG

Edited again to fix link... cut\paste don't always play well with HTML LOL!

m.a.l.'s pa 11-08-2015 04:34 AM

I'm running Unity in Ubuntu 15.10 at the moment. Went to gnome-terminal and simply highlighted some text (in this case, $ man man). Pasted the text into a text document (using the Geany text editor) by clicking on the middle mouse button (the mouse wheel). Same thing worked for pasting the text into a web browser (Chromium).

zk1234 11-08-2015 04:43 AM

Quote:

Originally Posted by m.a.l.'s pa (Post 5446403)
I'm running Unity in Ubuntu 15.10 at the moment. Went to gnome-terminal and simply highlighted some text (in this case, $ man man). Pasted the text into a text document (using the Geany text editor) by clicking on the middle mouse button (the mouse wheel). Same thing worked for pasting the text into a web browser (Chromium).

Good answer! Highlighting (for coping) and middle mouse button (for pasting) will work for both the directions: "from terminal to terminal" and "from terminal to external GUI" (e.g. text editor or web browser).

zk1234 11-08-2015 04:50 AM

Quote:

Originally Posted by ondoho (Post 5446394)
yes, it is possible.
linux uses 2 clipboards, primary and secondary. simply highlighting the text copies to the primary clipboard. inside the terminal you canthen paste with 'Shift+Insert'. try it.
however, it doesn't carry over to your browser.
some terminal emulators have the additional 'Shift+Ctrl+C' (and '...+V') commands to use the secondary clipboard.
what terminal emulator are you using?

4MLinux uses xterm + aterm (strictly speaking: aterm with the "-tn xterm" option) by default.

ondoho 11-08-2015 05:27 AM

Quote:

Originally Posted by zk1234 (Post 5446407)
4MLinux uses xterm + aterm (strictly speaking: aterm with the "-tn xterm" option) by default.

i hadn't noticed that this is the 4mlinux subforum.
xterm + aterm do not use the secondary clipboard afaik.

good to know about the middle mouse click working both ways!

i usually use a clipboard manager with hotkeys...

John VV 11-08-2015 01:20 PM

Quote:

Is copy and paste from Terminal to other applications like Chrome or Leafpad supported?
basically the EXACT same as it is on Windows and OSX

WHY would it not be ????????

some programs might not support it but the os dose

jamison20000e 11-08-2015 01:49 PM

Why, when? ???

Edit\add: I like that I can copy text from almost anywhere in Linux, dialog boxes &c...

I think I missed the "not" in John's statement. :doh:

SansSg 11-08-2015 06:07 PM

Hi, other than middle mouse click, any other way to paste text?

Anyway to change the default "-tn xterm" option?



Quote:

Originally Posted by zk1234 (Post 5446407)
4MLinux uses xterm + aterm (strictly speaking: aterm with the "-tn xterm" option) by default.


SansSg 01-09-2016 09:17 PM

For those without mouse and cannot do middle click, can try start xterm using these parameters:

xterm -ls -xrm 'XTerm*selectToClipboard: true'&

then Ctrl-Insert: Copy from xterm/apps after selection
and Shift-Insert: Paste selection into xterm/apps


All times are GMT -5. The time now is 04:47 PM.