6

I find myself ssh-ing into another machine a lot at work. So much so, that I use it more than simply using the terminal on my own desktop.

I know that (normally) when I open a new tab, it will change the directory to be in the same folder that I am currently in. Is there any way to have it check to see if I'm ssh'd into another machine and, if so, ssh into that machine as well so that I don't have to key in the host, port, and flags for the new ssh with each open tab?

1 Answer 1

6

gnome-terminal → edit → profile preferences → title and command → run a custom command instead of my shell

you might want to make a new profile for using the local shell.

you can choose the default profile in edit → profiles

if you have to specify passwords when connecting over ssh, set up private/public key authentication.

5
  • That was perfect. Thanks! Also, would you happen to know how to clear the screen of the output after running that command? I tried just using an ssh ... && clear at the end but that raises an error.
    – ashays
    Jul 23, 2012 at 20:59
  • && is bourne shell, it is not a command. you could do sh -c "ssh .. && clear" Jul 23, 2012 at 21:05
  • That appears to run, but not actually remove the output.
    – ashays
    Jul 23, 2012 at 21:09
  • why not just set "when command exits" to "exit the terminal"? Jul 23, 2012 at 21:13
  • I was wanting to supress what I thought was a message from ssh whenever I connected, but it actually appears to be a banner from the machine I'm connecting to. I think it's a separate problem entirely now. Thanks!
    – ashays
    Jul 23, 2012 at 21:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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