I'm a bit of a tmux novice, so there may be a really easy answer to this question, but the title pretty much sums up the question.
Let's say I am ssh'd into a server in a tmux window and I go <prefix>-C. All of a sudden I have to ssh again, which can get annoying. Is there any way to automatically realise that I'm opening up another window from an ssh window already and run that same command in the new window automatically?
sshfirst and then runtmux a || tmuxon the server (actually this is in my.bashrcthere). In my local terminal emulator usually I spawn one tab per machine andsshaccordingly. My localtmuxhas nothing to do with the remote one(s). I tend not tosshto an interactive shell from within tmux. There are disadvantages but big advantages are: (1) If I'm on machine A, no tmux-related action will put me on B. (2) Remote tmux servers survive local reboots (compare this question and my answer there). – Kamil Maciorowski Oct 12 '19 at 22:10split-windowwithnew-windowin my answer there. – Kamil Maciorowski Sep 23 '23 at 21:53