Score:1

How to copy apt-get command suggestion?

vn flag

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.

Nmath avatar
ng flag
If you will let us know exactly which terminal application you are using we can help you look it up.
crip659 avatar
pl flag
I always do it this way. Just copy the command on the page and paste in your terminal. Just make sure you know what the command does, some commands can do nasty stuff. There is also a more permanent clipboard like app, where you can copy often used commands/lines, but I forget the name of it right now.
muru avatar
us flag
^Or you can get it to install the package for you directly.
Score:1
vn flag

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:

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.