Map keyboard key to unix command

keyboardmappingterminalunix

Simple I am looking for a way to map a keyboard key to a unix command. It could be as simple as literal as opening up terminal and pasting a required bit of text.

Best Answer

You could use a tool like Keyboard Maestro but it might be a bit overkill.

If you just want to execute a command in Terminal and close the window again:

  • Put command in a shell script
  • Make it executable (chmod +x ...)
  • Move shell script to a convenient place (e.g. our Desktop)
  • run shell script/command by double click