title: Run ssh and immediately execute command
body: <p>I'm trying to find UNIX or bash command to run a command after connecting to an ssh server.  For example:</p>
  
  <pre><code>ssh name@ip "tmux list-sessions"
  </code></pre>
  
  <p>The above code works, it lists the sessions, but it then immediately disconnects.  Putting it in the sshrc on the server side works, but I need to be able to type it in client side.  I want to be able to run a command, it logs in, opens up the window, then runs the command I've set. Ive tried </p>
  
  <pre><code>[command] | ssh name@ip
  
  ssh name@ip [command]
  
  ssh name@ip "[command]"
  
  ssh -t name@ip [command]
  </code></pre>