When I copy something to the clipboard and press Ctrl + V in Bash, nothing happens; However, right clicking and selecting Paste does the job.
Why? Is there any reasonable issue (I'm sure there is) behind this behavior in Linux?
In the days of physical terminals, session-wide clipboards did not exist, only few programs supported internal copy/paste – often under the name of "buffers" or "kill rings" – and used various different keystrokes. For example, the bash shell uses CtrlK or CtrlU to "kill" (cut), CtrlY to "yank" (paste); this comes from the emacs editor.
CtrlC almost everywhere in Unix was the "interrupt" key, used to cancel the current program or operation. The CtrlV key often meant "verbatim insert" – that is, insert the following character literally without performing any associated action. For example, a normal Esc switches to command mode in the vi editor, but CtrlV, Esc will insert the
The use of CtrlC to copy and CtrlV to paste from session-wide clipboard was introduced by Mac OS in 1983 and Microsoft Windows 3.x in 1990. (Earlier Windows versions (1.x and 2.x), as well as IBM OS/2, only supported the IBM CUA keys CtrlIns to copy and ShiftIns to paste; these shortcuts remain supported by all Windows versions.)
When GUIs with clipboard support finally reached Unix, the Ctrl keypresses were already in use by many terminal programs. In addition, the X graphical interface had somewhat different mechanisms: "selections" and "cut buffers". Even now you can select text in one program and insert it using the middle mouse button, without any explicit copy action.
In short, by the time Xterm and GNOME Terminal were written (I'm guessing you use the latter), CtrlV already had a completely different meaning for many years and could not be changed. In addition, an alternative method of copying text – the "selection" – was already present in X11, so explicit copy/paste action was probably considered not as important as it would be in Windows. This means that different keyboard shortcuts had to be selected – for example, most modern terminal programs, like GNOME Terminal, use CtrlShiftC and CtrlShiftV. (If you use Xterm, the same shortcuts can be added manually using Xresources. Rxvt does not have such an option.)
(Most X11 toolkits also support the CUA "copy" and "paste" keys, which do not conflict with terminal programs. Unfortunately, the implementations are rather inconsistent – CtrlIns copies to the "clipboard" in most programs (GTK, Qt4, but ignored by Xaw); however, ShiftIns pastes from the "primary selection" in most GTK and Qt4 programs, but from "clipboard" in Firefox, and from the now-obsolete cut-buffers in the now-obsolete Xaw.)
All that said, some terminals or consoles (in particular, the Windows 10 console) do support these keys. As the Windows console always had a separate "mark/select" mode, CtrlC now also has two meanings based on context – in regular mode it sends an interrupt, in select mode it copies to clipboard (just like Enter used to).
Meanwhile, Windows command-line tools never really used CtrlV for anything, so it was bound to "paste" without disturbing much anything. Doing the same on Unix-like terminals however would be more problematic.
Use CtrlShiftV for pasting.
Ctrl with other chars is usually used by the shell for special functions.
It is a deep rooted tradition that the Ctrl key together with a letter generates ASCII control characters found by subtracting 64 from the upper case letter's ASCII value. This calculation maps Ctrl-A to 1, and so on. For instance Ctrl-I is Tab and Ctrl-J is linefeed.
There is no similar tradition for Ctrl-Shift. Ctrl-Shift-V is not expected to produce any specific character.
Terminal emulators must support tradition by transparently passing through the Ctrl convention, letting it appear as character input to the programs being operated through that terminal window. Terminal-based programs map control keys to commands. For example, Bash uses Ctrl-V as a command which means "take the next character literally". This allows you to embed a control character in the command line. If the terminal steals control keys for its own use, such commands become unavailable. So intercepting Ctrl-V for a meta-function is out of the question (at least in a default configuration).
However, terminal emulators are free to intercept Ctrl-Shift-V which isn't expected to generate a character. Ctrl-Shift-V isn't a standard; it's a Gnome Terminal thing (which may be in some other terminals).
On X-based Unix desktops the convention is that no command is needed to copy. You just select the text. And the middle button pastes that text elsewhere. You will find that it works in Xterm, Gnome Terminal and Firefox alike.
Ctrl-V is a Microsoft Windows convention, which is an imitation of Apple-V from the Macintosh.
Here's your general-purpose copy paste settings with popular terminals:
gnome-terminal (most popular on Linux)
PuTTY (most popular terminal in Windows)
We can use insert keyboard button to do copy and paste(In old keyboards it can be missing)
you can also use the middle button an a mouse if you are feeling lazy and select a command from either a text document, script or web or forum. once you've selected the intended command simply move to your terminal and click the middle button on the mouse. I use this method as I use puppy linux which doesnt seem to support the normal behaviour of right click and paste. it does in a file handler window, just not in a terminal window. dont know why but I'm quiet pleased I found out about the middle button method, very handy! ;-)
To me, the simplest way to copy paste in the shell is:
Select the code you want and then past it by clicking the mouse-middle-key
Thank you for your interest in this question.
Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site.
Would you like to answer one of these unanswered questions instead?