Using stock Terminal.app on El Capitan, the effort is to set up a shortcut in a sense, that upon press it would execute a specific command.

Consulting man pages for bind command following steps have been taken but yielded no results.

First approach was to place the setting inside ~/.inputrc file and let the login session do its work. The current state of the file is:

"\C-s": "ssh hostname"

Second, used bind command directly.

$ bind '"\C-s": "ssh hostname"'


GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin15)


Add a newline character to the end, for example:

bind '"\C-s": "ssh hostname\n"'

Another thing is what key sequence you want to bind the command to, and if it's not already handled by the system. For example, for F12, which is available, you'd use:

bind '"\e[24~": "ssh hostname\n"'
| improve this answer | |
  • The second suggestion worked as advertised. However, I was not able to replicate it with the first one, not even using different set of letters. Anyway, I thank You. – Felicio Aug 28 '16 at 9:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .