1

If I were to run a command that Ubuntu recognizes, but that I don't have installed, something like the following would take place:

$ command
Command 'command' not found, but can be installed with:
sudo apt install command
:~$

Although most of the time, I could just copy whatever the suggested command by typing it, it would be nice if there was a way to copy sudo apt install command into my clipboard so I could paste it and save time.

Is there any native way to do this in Ubuntu?

Edit: I am using WSL 2 on Windows 11.

muru
  • 207,228
Mailbox
  • 111

1 Answers1

1

In a number of modern terminals (the ones I use at least), simply selecting a line copies it to the clipboard by default, while right click (or middle click) inserts (should be configurable).

So for those terminals, simply select the line sudo apt install command, and right or middle click (depending on configuration) to paste it at the cursor position.

I know for a fact that the following terminals support this:

Artur Meinild
  • 31,035