How can I tell what command is running on the remote end of an ssh connection?

Posted by user268385 on Super User See other posts from Super User or by user268385
Published on 2013-10-31T09:42:29Z Indexed on 2013/10/31 9:58 UTC
Read the original article Hit count: 166

Filed under:
|
|
|

Tl;dr - how do I find the name of the command (eg $BASH_COMMAND) running on the remote end of an ssh connection?

...

My example setup is two tmux vertical panes,

  1. LH pane runs a local vim session with vertical split,
  2. RH pane runs an ssh session running vim, again with a vertical split.

Using tmux-navigator I can navigate from left to right over the first 3 vim buffers, but the 4th (far right hand one) is inaccessible.

The reason for this is that tmux-navigator tests the value of 'pane_current_command' and compares it to 'vim' before deciding which keystrokes to dispatch. On the right hand tmux pane, the current command is 'ssh' and not 'vim'.

What I want to do is test for (pane_current_command =~ 'ssh'), and if so, examine the command that is running on the far side of the connection? I cannot find a way to get hold of this, so any suggestions would be welcome?

For information, the problem is almost the same as this one, but without the nested tmux sessions: https://github.com/christoomey/vim-tmux-navigator/issues/12

© Super User or respective owner

Related posts about bash

Related posts about ssh