1

I'm on Ubuntu and I use either GNOME Terminal or Terminator.

I'd like to be less reliant on the mouse/touchpad. Say that I have the output of ls in the terminal and I want to copy out part of the output, so that it can be used in input for the next command I enter into the terminal.

Current method: Move my mouse to the part of the terminal output, highlight it with the cursor, right-click and copy. Hit Ctrl+Shift+V to paste it into the command line.

Ideal method: Enter a keyboard shortcut so that I switch to a "buffer mode", where I can move through the terminal output as if it were a text file (say in Emacs). Use my keyboard to find the relevant part of the output, use Emacs-like commands to select that output and copy it. Exit this "buffer mode" and return to the command line where I paste the text, all using only the keyboard.

Is there a way to use the ideal method above somehow? Perhaps a specialized terminal application someone could recommend? I would prefer not to use something bloated like Emacs itself!

2 Answers 2

1

Use tmux

Use tmux inside the terminal emulator of your choice.

  1. Tmux is very keyboard friendly.
  2. You can configure the buffers to be as large as you want.
  3. You can scroll through them and do the cut and paste stuff that you described.
  4. When your window manager crashes you can just open a terminal and get back to exactly where your terminal session was.
  5. Tmux is like screen, but modernized and friendly to automation.

If you spend your life in a terminal it is very handy.

1
  • tmux is brilliant. It's exactly what I need, thanks!
    – dbrane
    Nov 25, 2021 at 3:10
0

There's other terminal emulators than gnome-terminal, which are better-performing and have features that gnome-terminal is simply lacking. (I count "not having a strange rounded grey rectangle above my terminal that is 90% no functionality, 5% burger menu" a feature by now. Gnome's UI design hasn't gotten any better; not everything is a smartphone app, and smartphone apps for good reason haven't developed the way GNOME thought they'd do, in 2010. But I digress.)

Alacritty has a feature that lets you enter a editor-like cursor mode, from which you can copy.

By default, the "enter/exit Vi mode" key combo is ctrlshiftspace, and you can move around with cursor keys or hjkl, start a character-wise selection with v, a row-wise with V, or a rectangular-block-wise selection with ctrlv, and copy with y. But of course, you can mess up the keybindings to your heart's delight.

Sadly, alacritty hasn't found its way into Debian yet (and Ubuntu mostly just copies Debian's packages), so you need to install some sketchy PPA or use snap (sudo snap install alacritty --classic) to get alacritty (or build from source, if that's more to your liking).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .