Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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.

share|improve this question
    
What sort of key? I assume you want a modified key, and don't want, say, the <kbd>L</kbd> key to not type a l but rather run sudo rm -Rf / –  Daniel Lawson Feb 9 '12 at 1:30
add comment

1 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
share|improve this answer
    
I just want to run a command (eg pwd) in terminal via a keyboard key. When you press the key it could open terminal and paste in PWD and then close terminal, but this would be sloppy. –  ThomasReggi Oct 9 '11 at 20:52
    
Maybe a shell script is ok then, I've extended the answer accordingly. –  patrix Oct 10 '11 at 6:09
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.