I do a lot of remote programming on my CentOS linux server by opening an X11 xterminal window on my Mac OS, and SSH into the server. I'm looking for an easy to use method to enter a predefined text string when hitting a customized hotkey.

For example, instead of manually typing:

# cd /home/users/jim/jcode/algorithms/applications

I'd like to type something like command-A, or enter a custom key sequence like ";app" at the command line and have it be replaced with the text above.

I tried various programs like TextExpander (http://smilesoftware.com/textexpander/faq.html), on my mac, but they don't support X11 xterminals.

Anyone know of a good way to achieve this?

  • 2
    You could easily define environment variables, functions, and/or aliases in your shell on the remote host. If you connect to a lot of different hosts, and they all have different needs, this may be less attractive (but then so will your proposed solution).
    – tripleee
    Jul 8, 2013 at 16:58
  • I edite my .inputrc file to use hotkeys with Bash. This is a partial solution. Where it doesn't work, for example, is when I need to restart GlassFish server, I enter the admin console using # ~/glassfish3/bin/asadmin then asadmin> restart-domain --port 1234. Once I'm at the asadmin> prompt, the Bash binding aren't recognized. I'd need something listening to the xterm key commands to replace them with some predetermined text.
    – user42606
    Jul 8, 2013 at 17:08
  • You can't use asadmin <<<'restart-domain --port 1234' then? Of course, this still doesn't solve the general problem.
    – tripleee
    Jul 8, 2013 at 17:16
  • Not sure. I was getting to the asadmin> command prompt by pressing Escape-a (since the .inputrc file contains: "\ea":"~/glassfish3/bin/asadmin\n")., then trying to press Escape-r to run the following command in .inputrc file: "\er":"restart-domain --port 1234\n". What should I be trying instead?
    – user42606
    Jul 8, 2013 at 17:24


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.