Copy and paste in the terminal - Debian

digitard

Active Member
Joined
Jan 3, 2021
Messages
115
Reaction score
37
Credits
1,041
I use the pre installed UXterm and Xterm
Right click has no pop up menu in the terminal
right and left click simultaneously behave weirdly
I just want a right click pop up menu in the terminal
What must I do?
Thank you
 


I cracked it:

1) Create a new empty document in the desktop of Debian.

2) Copy and paste commands from browser or wherever you find them on your empty document.

3) highlight the text you want on the document (just select it and do nothing)

4) put the mouse point on the xterm and click the middle button (roller)

EDIT
TL;DR
First attempt to use Linux and you find a guy willing to help you ''You have problem with Linux? no problem just put this command on the terminal: [3 lines command]''. Then you open the terminal and you try to copy and paste ... NOP.

I don't need fancy environments and tick boxes, I just don't want to put an unbelievable and unjustifiable amount of effort in order to even try something, paste the dam thing. Unbelievable.

The most insane are the solutions that they suggest for ''copy - paste in terminal'' in forums and tutorials. Find file with some name at some place that not even exist and edit it with some way that not mentioned at all, then add a line in an unspecified place and you done. Meanwhile you have to put some 3 lines commands in the terminal to follow their instructions xD
 
Last edited:
You can skip the "create new empty document" step. Highlight text (like a terminal command) in your web browser and use CRTL-C to copy the text. Open your terminal and use CTRL-SHIFT-V to paste the text. Or using the middle-click button should work too.

To copy text FROM the terminal, hightlight the text you want and use CTRL-SHIFT-C.

The terminal cannot use CTRL-C to copy because it is used to stop a running process in the terminal. For example, run the command top to see a live running assessment of what is using your computer memory. Use CTRL-C to stop this process.

CTRL-C and CTRL-V usually work to copy/paste in Linux the same as in Windows, so it works in your web browser. But the terminal is an exception.
 
You can skip the "create new empty document" step. Highlight text (like a terminal command) in your web browser and use CRTL-C to copy the text. Open your terminal and use CTRL-SHIFT-V to paste the text. Or using the middle-click button should work too.

To copy text FROM the terminal, hightlight the text you want and use CTRL-SHIFT-C.

The terminal cannot use CTRL-C to copy because it is used to stop a running process in the terminal. For example, run the command top to see a live running assessment of what is using your computer memory. Use CTRL-C to stop this process.

CTRL-C and CTRL-V usually work to copy/paste in Linux the same as in Windows, so it works in your web browser. But the terminal is an exception.
In Debian and specifically in xterm none of the key combinations work because you can't paste in xterm from clipboard, it has to be from the primal buffer which is an other memory place. In Debian you cannot paste the content of the primal buffer because perhaps it is constantly overwritten when you use the browser or for some other reason it's usually gibberish or empty.

So for Debian users it is what I say above, no key combination works (with laptops it's even hell to use the insert key, do not bother at all). And if you want to pick up text from terminal to use it in forums etc you highlight the text on xterm, paste it on you document with middle click and from there you do what ever you want with it. Those instructions should be in your face as soon as your first boot.
 
Why xterm? It is ancient and there are many better terminals available.

But anyway, I just tested Debian 10.7 Gnome in a virtual machine.... using xterm.

1. Highlight text in web browser and CTRL-C to copy the text.
2. Use the middle-click button (scroll wheel) to paste the text in xterm. It works.

More modern terminals will allow CTRL-SHIFT-V, but apparently not xterm.
 
Why xterm? It is ancient and there are many better terminals available.

But anyway, I just tested Debian 10.7 Gnome in a virtual machine.... using xterm.

1. Highlight text in web browser and CTRL-C to copy the text.
2. Use the middle-click button (scroll wheel) to paste the text in xterm. It works.

More modern terminals will allow CTRL-SHIFT-V, but apparently not xterm.
When you first boot to Debian and you haven't yet successfully installed anything (i still haven't successfully installed anything from the command line or synaptic) you obviously can't have any other terminal than xterm which is preinstalled. If it does the job I will not change it anyway, not now where I have cracked it.
 
Your Debian may already have another terminal pre-installed. Mine does.

You can choose to learn new (and maybe better) ways of doing things, or not. It doesn't matter to me.

Good luck.
 
7658768765.jpg

This is what it's preinstalled, all those terminals works the same way concerning copy paste. Assuming that all the pre installed terminals are listed there together, those are my choices. If thers something else please dont keep it secret. Thank you
 
Open Synaptic Package Manager. Do a search for "console" or "terminal". Look through the output, there are options. Be curious.

It's all open source, there are no secrets. Favorite solutions, maybe, but no secrets.
 
Code:
sudo apt install terminator

That one is pretty popular. It does tabs, as most modern terminals do, and has a ton of other features.

My favorite is actually from xfce. I just prefer the layout of the options better, I think. I dunno, I've been using it for years.

Code:
sudo apt install xfce4-terminal

They both take up little space. Feel free to install 'em both - and more.
 
Hi @digitard
You asked in your first post "what must I do?"
Perhaps a better way to phrase the question is "what can I do?"
I installed xterm just to see how it functions.
BTW I'm using Linux Mint - 19.3 presently.
Here are three pictures showing what happened.
Xterm-1.png

This is the xterm terminal showing what you had posted, which I copied from your post using Ctrl-C.
Then pressing the mouse wheel to paste it into xterm.

This second pic shows how I copied it from xterm using Ctrl + Shift + C. Notice the ^C at the end of the file. That's one way to show Ctrl + C.
Xterm-2.png


And last, is the next picture where I pasted what I had copied from xterm. I used the mouse wheel to do the pasting in LibreOffice Writer.
Xerm-3.png


If you are open to suggestions for an easier experience, get Linux Mint 20.1 and use the default terminal, which I believe is Gnome.
Here's a picture of it with the menu you can use, which includes copy and paste in the edit section.
xterm-4.png


It is so much easier to learn and use because it is straightforward and simple.
Copy - Go to Edit and click on 'Copy'.
Paste - Go to Edit and click on 'Paste'.
Or, in the terminal:
Ctrl + A - This highlights everything.
Ctrl + C - This copies everything.
Ctrl + V - This pastes everything.

Hope this is clear for you.
Old Geezer TC
 
Some terminals support Ctrl-Shift-C for copy and Ctrl-Shift-V for paste. Konsole is a prime example of this.
 
Thanks for the advices. Apparently for me ctrl+v and middle click does not work. Just highlight from document (not browser) and middle click in the terminal. Maybe the operating system and the my keyboard type are also on play here. It seem that the document way works when evrything else fail.
 
I use Debian, but I install with the minimal net installer so I can avoid installing Gnome! As mentioned many times here - I use a personally modified version of suckless dwm instead of a traditional desktop. And I hand-pick my software selection myself.

My terminal of choice is suckless st (aka stterm).
To select text in st, you can use the mouse and then ctrl+shift+c to copy (and it copies to the system clipboard) and then ctrl+shift+v to paste in the terminal. Or in another application, like a browser, or a text editor, you can use ctrl+v - or whatever other keybinds are bound to paste in your chosen application.
e.g. "+p for pasting from the clipboard in vim.

However, when using the terminal, I often use tmux.
For copy/pasting using the system clipboard in tmux, I use a plugin called tmux-yank:
Source that from your .tmux.conf file and you can use tmux's built in copy/paste functionality to copy/paste to/from the system clipboard.

To use tmux yank:
1. Enter tmux's text selection mode using [leader combo] and then pressing [
NOTE: The default leader combo in tmux is ctrl+b, but I remap it to ctrl+a, so I press Ctrl+a and then [ to get into text-select mode.
- Use vim or emacs style keybinds to navigate through the text onscreen (I use the vim style keybinds)
- Move to the start of the text you want to select and press space.
- Then move the cursor to the end of the text you want to yank
- Press y to yank the selected text to the clipboard.

To paste inside the terminal in tmux, use [leader combo] and then ].
And because tmux-yank copies to the system clipboard, you can paste the text into any other application via the system clipboard using ctrl+v, or whatever other keybind is bound to the paste action.

Pretty simple!
 

Members online


Latest posts

Top