Apple - How do I open a new Terminal window ssh'ed to another machine from the command line?
There is a way to do this with
osascript -e 'tell application "Terminal" to do script "exec ssh localhost"'
Replace 'localhost' with the host name to which you wish to connect. You can include a username if the remote name is different from your local username, this would look like
[email protected]
\____/\_____/\______________/
| | `- Domain name, you may be able to omit if on the same network as 'remotey'
| `- Remote hostname
`- Specify remote login name followed by '@', can be omitted for same username
This suggestion is a variation on the top answer at https://stackoverflow.com/questions/31524499/open-terminal-from-shell-and-execute-commands
Use exec ssh
instead of ssh
if you want the window to close after logging out. If you use the 'exec ssh' option and your window stays open, then check your Terminal preferences--under "Profiles" > "Shell" > "When the shell exits:" is probably set to "Don't close the window"