When one issues a command that does not exist in the terminal, it results in:
The program 'programname' is not installed. You can install it by typing:
sudo apt-get install programname
Is there any shortcut by which one does not have to retype the 'sudo apt-get install programname' line?
There is none by default, but it is not so hard to define one:
You can then just call
For more information, read
man bash
on aliases and history.Since the suggested command was not typed before, it won't be in the bash history. So Up Arrow or
.bash_history
will not help.setting an alias for
sudo apt-get install
will reduce some typing but you still need to type the name of the program, particularly if the programname is differnt from the package-name.The simplest way to "type" the command without typing is to copy the line from the terminal and paste it.
sudo apt-get install programname
using the mouse and press Ctrl+Shift+C.$
prompt and press Ctrl+Shift+V.Hope this help.
Assuming the part you are trying to avoid is re-typing the last command, you can use the bash built-in "bang-bang" as a parameter for apt-get:
That will replace the "!!" with the previous command you typed.
Here's a reference about other advanced shell features:
http://www.deadman.org/bash.php
Yes, just hit the Up Arrow key on your keyboard. Hit it again to invoke the command you used before, etc.
Also, you can check out the history of your issued commands by entering: