2

I know there is a shortcut to copy and paste contents in a Linux terminal. In addition, you can scroll through the contents of a terminal window by using Shift+PgUp and Shift+PgDown.

But is there any shortcut to select text or highlight text in a terminal without using a mouse? Unfortunately, I could not find an answer to this question; that is why I am asking here.

To clarify, I wanted to know about a keyboard command that will scroll through the terminal contents or output in the terminal. And it does not have to be a Gnome terminal; it should be some universal command for all kinds of the terminal. Like selecting the ID of a docker container after building the image.

lone wolf
  • 138
  • 5
  • 19
  • Does this answer your question? [Share the clipboard between bash and X11](https://unix.stackexchange.com/questions/18701/share-the-clipboard-between-bash-and-x11) To answer your question: it's **not** possible directly. As to whether the linked answer works in Wayland - I've no idea. – Artem S. Tashkinov Oct 29 '21 at 05:28
  • Does this answer your question? [Share the clipboard between bash and X11](https://unix.stackexchange.com/questions/18701/share-the-clipboard-between-bash-and-x11) – Toby Speight Nov 11 '21 at 15:27

2 Answers2

1

Have a look at tmux.

The default shortcut to enter "copy mode" in tmux is Ctrl-b [, from where you use Vim-like shortcuts to select and yank text and to paste you use Ctrl-b ].

Vilinkameni
  • 710
  • 1
  • 4
  • 11
  • I was looking for some command that will be universal for all terminal emulators, like Konsole, Gnome terminal and the list goes on. – lone wolf Oct 29 '21 at 12:02
  • tmux is independent of a terminal emulator. It is a [terminal multiplexer](https://en.m.wikipedia.org/wiki/Terminal_multiplexer). – Vilinkameni Oct 29 '21 at 12:08
  • indeed, and screen has a similar thing. and they're great, because if you accidentally close the window, you just open it back up like nothing happened – Fox Oct 29 '21 at 15:23
1

Selecting text can be a function of your shell or of the of the terminal emulator you are using. Alacritty is one that supports vi-like text selection with keyboard shortcuts.

Philippos
  • 13,237
  • 2
  • 37
  • 76