I was hoping to configure a keystroke command using BetterTouchTool to open a terminal window and run an ssh session. I do this a lot to connect to a RaspberryPi on my network. The execute terminal command seems to execute the command without opening a window, and all the help I can turn up on Google is people asking how to run commands without opening a window. So what would be the best method for me to open a terminal window and execute ssh [email protected] in that window?
So, if I understand you correctly, you want to just click on a shortcut on your Desktop (or somewhere else) that will open Terminal.app and connect to a particular host via SSH.
The quickest way would be to create an AppleScript that opens Terminal and executes the command
First... Here's the code you are going to need:
Make sure you change the "user" and "host" to its appropriate values; your username and the host/ip address you wish to connect to.
tell application "Terminal" activate do script "ssh user@host" in front window end tell
You have to put that into an AppleScript script then "bundle" it as an Application.
Open AppleScript Editor
You can find AppleScript Editor in the Utilities folder, but I find it much easier to hit Command + Spacebar to invoke Spotlight Search and just start typing "AppleScript" and hitting RETURN when it's found.
Once launched, create a new document and past the code I provided.
Save your Code as an "Application"
When you save your App, save it to your Desktop, give it a useful name and make sure you select "Application." You can ignore the "Options" at the bottom.
Launch Your App...
An icon will appear on your desk with the name that you gave it in the previous step. Click on it to Launch your newly created app.
Your terminal window will launch issuing the command you programmed: