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


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.

  • 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
    Commented Jul 23, 2012 at 20:59
  • && is bourne shell, it is not a command. you could do sh -c "ssh .. && clear" Commented Jul 23, 2012 at 21:05
  • That appears to run, but not actually remove the output.
    – ashays
    Commented Jul 23, 2012 at 21:09
  • why not just set "when command exits" to "exit the terminal"? Commented 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
    Commented Jul 23, 2012 at 21:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .