Domanda

Does anyone know of a simple way to map a command to an unused keyboard shortcut so that when I press the shortcut when typing in the terminal it inserts the command? Specifically I'm looking to quickly execute the series of commands

make; sudo make install; sudo ldconfig

It's not a long command, but I end up typing it about 100 times a day. The ideal solution would work in any directory and would be automatically mapped on startup. OS is Ubuntu 12.10. Any suggestions?

È stato utile?

Altri suggerimenti

Use a bash alias.

Put a line like this in your .bashrc, .bash_profile, or any file sourced in one of these. I have a separate file for aliases called .bash_aliases.

alias fullmake="make; sudo make install; sudo ldconfig"

Then you can just run fullmake in a shell.

Perhaps you may want to try https://github.com/dvorka/hstr which allows for "suggest box style" filtering of Bash history with (optional) metrics based ordering:

enter image description here

It can be easily bound to Ctrl-r and/or Ctrl-s - therefore you can insert to command prompt recently (and often) used commands quickly.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top