Copy and paste doesn't work in the terminal
Solution 1
There are different ways to mark/copy and paste in linux. One of them works in all terminal emulators that I know, including xterm
.
1. The linux mark and paste method - 'middle clicking'
Mark the text, that you want to paste by pressing the left mouse button and move the mouse. (You can left click twice to mark a word or three times to mark a line.)
Move the mouse cursor to where you want to paste the text.
Press the middle button or scrolling wheel (like it were a button). If no middle button, press the left and right buttons at the same time.
In a terminal window, the text will be pasted at the cursor position. This works in the same terminal window, in another terminal window as well as in other programs, for example Firefox and gedit.
2. A method that works in many but not all terminal windows
2.1 Via menus
Mark the text, that you want to paste by pressing the left mouse button and move the mouse.
Use a pull-down or right-click menu and select 'Copy' (to clipboard).
Move the mouse cursor to where you want to copy the text.
Use a pull-down or right-click menu and select 'Paste'
2.2 hotkey combination with ctrl
Mark the text, that you want to paste by pressing the left mouse button and move the mouse.
Press shift + ctrl + c to 'Copy' (to clipboard).
Press shift + ctrl + v to 'Paste' into another terminal window.
Press ctrl + v to 'Paste' into a normal GUI application program, for example Firefox or Gedit.
Solution 2
Have you tried using Ctrl+Ins and Shift+Ins? I'm not sure about copying, but pasting works fine for me. Give it a try and EDIT your question if it doesn't work.
Solution 3
FWIW, I don't do much cutting & pasting in a terminal. Just typing. What are you up to that makes cutting important?
Copy/paste is provided by the terminal program, if at all. There is no general answer. Since you don't tell us which terminal emulator you use, we cannot help. If terminal has pull down menu (gnome terminal), you may get hints. I am almost sure there is no Ctrl+V in xterm or rxvt.
ALSO can get cut/paste from program you are running in terminal. Launch emacs
in a terminal, cut is Ctrl+W and paste is Ctrl+Y.
The only general paste feature will come from the basic Linux OS. This works in a Virtual Terminal (Alt+Ctrl+F1) as well. Use the left button to highlight. Then middle click to paste. Action must happen with no clicks between. Middle click is a focus and paste in one step. I use that all the time.
Also possible to install a clipboard imitation, maybe find terminal to cooperate with it. Transfer text from one program to another.
Solution 4
The one settings that was disabled on my machine preventing middle click paste to work as usual:
org.gnome.desktop.interface.gtk-enable-primary-paste
You can edit this value either by using dconf-editor (UI) or by using the cli:
gsettings set org.gnome.desktop.interface gtk-enable-primary-paste true
Related videos on Youtube
j0h
been using Linux since 2005. Ubuntu since whenever edgy eft was new. Lucid Lynx Ubuntu was the best Ubuntu I have ever used.
Updated on September 18, 2022Comments
-
j0h over 1 year
Before you go marking this as a dupe, I know about Ctrl+Shift+C and Ctrl+Shift+V
I try to use them, and it doesn't work. On one particular Ubuntu computer, normal copy paste commands do not work: They do not work locally, and they do not work via remote session.
My guess was that perhaps logging into a computer where these functions where acting normally, and logging in via ssh would bypass the issue. This was not the case. I still cannot gain this functionally, even though the Ubuntu PC I am using has functional copy and paste from the terminal.
So I am out of guesses.
How do I enable this? The affected computer runs Ubuntu MATE 16.04. The terminal is mate-terminal, except when I login via ssh, in which case it's Bash. Caja is the window manager.
-
muru over 6 years"even thought the ubuntu pc I am using has functional copy paste from the terminal" ... I'm confused - is copy-paste working or not?
-
wjandrea over 6 yearsSo the issue only affects SSH? How are you connecting SSH?
-
Panther over 6 yearsCan you clarify your question
-
j0h over 6 yearsI hope the issue effecting both local, and remote sessions has been clarified.
-
Panther over 6 yearsctrl-c and ctrl-v ? What does shift have to do with it ?
-
Panther over 6 yearsI guess we need to know what version of Ubuntu, what window manager, and what terminal.
-
wjandrea over 6 yearsBash isn't a terminal. It's a shell, which runs inside a terminal.
-
4mAstro over 6 yearsHave you tried selecting text and middle clicking?
-
Zanna over 6 yearsCaja isn't a window manager - it's a file manager/browser (default on MATE). The default window manager on MATE is Marco (a fork of Metacity). I use MATE, and Ctrl+Shift+C/V have worked fine for me in
mate-terminal
throughout my time using MATE (in 16.04, 16.10, 17.04). cc @bodhi.zazen since you asked about this :) -
Trevor Boyd Smith almost 5 yearsin profile preferences make sure "Copy selected text into clipboard" is not checked. see this github bug report.
-
Albert Veli almost 4 yearsI can confirm this problem on gentoo too. Switched from cinnamon to mate and on mate-terminal ctrl-shift-c and ctrl-shift-v works. Selecting text and pasting with middle button also works, but not selecting and pasting with shift-ctrl-v. There are typically three buffers where selections can end up. Primary, secondary and clipboard selection. In preferences, checking "Copy selection to clipboard" only works in the current tab. If you have two tabs in the terminal the selection doesn't follow over to the next tab. I guess this is a bug in the mate-terminal program.
-
questionto42standswithUkraine about 2 yearsNothing worked of the answers (and I usually use these copy methods anyway), I always pasted an old clipboard content. I had to type connection and pw to ssh into a server by hand, and also on that server, I could paste nothing. I also started new terminals, same problem. The only thing I remember having done is to exit the ssh connection. Somehow I could copy and paste after some time again, at least no restart was needed.
-
-
wjandrea over 6 yearsHow do you use the mouse in a TTY?
-
dessert over 6 years@wjandrea By using the General Purpose Mouse interface: How can I use the mouse in a virtual terminal?
-
fchen over 6 yearsI upgraded to Ubuntu 17.10, one thing is the default x-manager changed from unity back to gnome. Now the copy-on-select no longer work, when I use middle button to paste, it pastes some other clipboard buffer. I am still looking for solutions.
-
sudodus over 6 years@fchen, pasting with middle-click works for me in 17.10, even with Wayland. My system is a fresh install. I know that there are some problems with 17.10 systems that are upgraded from previous versions.
-
fchen over 6 yearsI switched from ubuntu xorg to unity and it works now. From other searches, people reported the copy-to-select works for a period and then won't work for some reason until you reboot.
-
polynomial_donut almost 6 years@fchen I'm on 16.04 and I'm experiencing the same problem :/
-
sudodus almost 6 years@polynomial_donut, please describe in a detailed way how you try to copy and paste, what you want and what you get. Which desktop environment and which terminal emulator are you using?
-
polynomial_donut almost 6 years@sudodus sorry.... I found out it's XFCE4 Terminal (0.6.3) - XTerm works alright. I'm using XFCE 4.12.2. If I'm highlighting text inside XFCE4 Terminal by click & drag via mouse, then the middle-click paste command seems to be simply ignoring this.
-
sudodus almost 6 years@polynomial_donut, I tested now, and it works for me in a live session of Xubuntu 16.04.1 LTS with the same versions of
xfce4
andxfce4-terminal
, that you specify. Are you running a system with only XFCE (but not Xubuntu)? Are there other things installed (for example another desktop environment), that might cause the problem? -
polynomial_donut almost 6 years@sudodus Oh maybe it's important to specify this, too:
lightdm 1.18.3
. I'm running Xubuntu, upgraded from 14.04 to 16.04. But the Ubuntu version upgrade didn't break this. I didn't install any custom DEs. -
sudodus almost 6 years@polynomial_donut, Do you mean that you inherited this behaviour (bug?) from 14.04 to 16.04.? I can check in 14.04 live too, but I don't know how to fix the problem in your upgraded system, because it works for me (and I do not intend to install and upgrade for the purpose of fixing it). By the way, I had big problems upgrading from 12.04 via 14.04 to 16.04 LTS, so that I made a fresh installation and afterwards moved manually what I needed from the backup. That way my 16.04 LTS system was (and is) good. I am in the process of doing the same thing now to get a good 18.04 LTS system.
-
polynomial_donut almost 6 years@sudodus no, I didn't inherit it at all ("the Ubuntu version upgrade didn't break this"). It must come from some post-Ubuntu-upgrade upgrade ( ; ) ). I thought about a fresh install, but this is my work desktop with a lot of work-related configs etc. ... and I'd rather spend my time on something else than make a config backup (which then might not work properly anyways... ). By the way, thanks a lot for the effort :)
-
sudodus almost 6 yearsLet us continue this discussion in chat.
-
sudodus almost 6 years@polynomial_donut, Welcome to the chat room :-)
-
Volker Siegel over 4 yearsHow to enable that?
-
Owl over 4 yearsIt doesn't work anymore. Has that systemd chap been tinkering with linux again ?
-
Suraj Subramanian almost 3 yearsThank you !
Shift + Ins
works for me in Windows/Putty. -
johndpope over 2 yearsjust run at terminal