I was wondering if there are shortcuts for selecting some text in terminal, just similar to holding shift and type arrow key in editing a text file in a text editor. Thanks!
3 Answers
I'm assuming you are referring to Gnome Terminal.
No - there isnt a Copy and Paste mechanism using just the keyboard - you can use various short-cuts to paste (depending upon your Ubuntu version) i.e. CTRL+ Shift + Ins , Shift + Ins or CTRL+ Shift + V to paste text in the clipboard.
However, if you type screen
you enter the terminal emulator which allows you to select, copy and paste text using just the keyboard.
To select (copy):
Press Ctrl + A together followed by Escape. This puts you into Copy mode. Using the cursor keys move to the beginning of the text you want to copy. Press Enter. Now move to the end of the text to be copied. Press Enter.
To Paste:
Press Ctrl + A together followed by ].

- 172,746
-
7My question is more about selecting text not about copying and pasting. – Tim Jul 30 '11 at 23:18
-
2I prefer using keys to select text instead of using mouse or touchpad. – Tim Jul 30 '11 at 23:24
-
nope - I must be thick! still dont understand - do you want to discuss this in chat? – fossfreedom Jul 30 '11 at 23:26
-
1Thanks! In a text editor, one can select text by pressing down SHIFT, and simultaneously pressing -> or <- keys. But in gnome terminal, this will not work. – Tim Aug 02 '11 at 17:26
-
2how complicated for such a simple task... I'm disappointed :( – Juh_ Oct 29 '14 at 10:26
-
What about terminator? is there a no-screen solution? – htellez Dec 30 '15 at 02:53
-
FWIW, there is a better description of how to use screen over here: https://stackoverflow.com/questions/312213/how-do-i-copy-text-from-my-xterm-without-a-mouse – Parth Shah Jan 10 '18 at 18:17
-
1I'm curious: why would you want to select text, if not to copy/paste...? – rsenna Jan 30 '18 at 21:18
-
In e.g. ConEmu terminal you can use SHIFT to select other text from the terminal text! – jaques-sam Apr 04 '19 at 12:38
-
@rsenna, the OP wants to be able to select the text without the mouse/trackpad. That's the topic. Yes, once you've selected some text in the terminal you probably want to copy it - but the OP already knows how to copy/paste via the keyboard. – Elliott Aug 30 '21 at 07:29
A bit late for the party but yes there is a way.
Replace the rodent with number pad navigation.
Settings -> Universal Access -> Pointing & Clicking -> Enable Mouse Keys
You can now use the 4 to go left, 8 to go up, 5 to click etc. (make sure NumLock is OFF).
NOTE: For this to work you need a NumberPad.
Moving the mouse with the number pad is going to be dog slow so lets fix that next. See man page for
xkbset
for details.sudo apt-get install xkbset
xkbset ma 60 10 10 5 2
Now you should be able to use the NumberPad to move your cursor at a reasonable speed, so move it to the terminal where you want to select the text.
To select the text in the terminal to the right of the pointer:
Ctrl+Shift+5+6
This is equivalent to mouse click=5, go right=6
To select to the right of the cursor:
Ctrl+Shift+5+4

- 2,081

- 61
In gnome-terminal
running bash as default shell, you can hit c-x
twice (c-
same as ctrl-
) to select the last typed text.
Refer to bash reference for more.

- 1
-
This doesn't seem to answer the question. To me it seems clear that the OP wants to be able to select any text in the terminal in the same way as you would be able to with a mouse - not just copy a previous input. – Elliott Aug 30 '21 at 07:59