4 ms·
I still like tabs. I'm often logged into multiple remote machines where, for me, a terminal emulator's tab represents a unique SSH connection and that tab then
by evilduck 14y ago
I still like tabs. I'm often logged into multiple remote machines where, for me, a terminal emulator's tab represents a unique SSH connection and that tab then has tmux running on the remote machine.
Otherwise, I'd be running tmux on my local machine, then want to run tmux on a remote machine, and nesting terminal multiplexers is not good.
- jeffcox 14y agoI think that's a big differentiator in people's CLI preferences. When I see prompts that don't include $HOSTNAME, and people eschewing tabs for multiplexing in all cases I just assume they rarely manage remote machines.
- q_revert 14y agoperhaps it's not that they don't manage remote machines, just that they do it differently to you.. nested tmux with $HOSTNAME/$IP in the hardstatus make this very easy imo, tells you where you are whilst also allowing you to keep a minimal prompt.. as i find long prompts can be incredibly annoying also, using ^a^a to send commands to the nested tmux isn't so bad.. but to get to the third one down you need to use ^a^a^a^a as you need to send a ^a^a to the second one in.. for the fourth nest you need 8 ^a's, but again, it's a bit like code indentation, if you're 4 tmuxes deep, then there's a good chance you're doing it wrong but still, it's nice to be able to do it if necessary
- keeperofdakeys 14y agoAs long as you keep a proper frame of reference, you'll be fine (I disable tmux's status bar on nested tmux sessions though). You can use C-a a, or something similar to send a C-a to the nested session, although it can be a little annoying.
- spudlyo 14y agoNesting terminal multiplexers is very good, I do it for exactly the use case you mentioned. Escaping your escape key is easy, with a little practice you won't even realize you're doing it. I have a shell function called 'go' that creates a new screen and labels it, connects to the remote host via SSH, and then recreates or re-attaches to the remote scren as appropriate. My top level screen session currently has 8 remote hosts I'm logged into, each running their own nested screen sessions. My go() function also reads my ~/.ssh/config file to grab all my host aliases so I can tab complete to them. Note, I'm a Perl programmer, and rarely write shell scripts, so this function may be kinda ugly. go() { local OPTIND OPTARG local SCREENCMD="screen -dRR" while getopts "xn" flag; do case "$flag" in x) SCREENCMD="screen -xRR"; shift;; n) SCREENCMD=""; shift;; esac done if [ "$#" == "0" ]; then echo "Need someplace to go." return 1; fi while (( "$#" )); do screen -t $1 ssh -tq $1 $SCREENCMD shift done } _go_show() { local curr opts cur="${COMP_WORDS[COMP_CWORD]}" opts=$(grep 'Host ' ~/.ssh/config | cut -d' ' -f2) COMPREPLY=( $(compgen -W "${opts}" ${cur}) ) } complete -F _go_show go
- bashinator 14y agoYou should know that the bash-completion package in Debian and kin does tab-expansion of ssh hosts in known_hosts and config. Also handles the --argument switches for just about all common utilities.
- philsnow 14y agoNesting terminal multiplexers is wonderful :) It kind of sucks if you accidentally use a hardstatusline in both the nesting and the nested muxes, and it slightly sucks if you use the same escape key for both/all levels of nesting. I have been using a nested screen setup for ~3 years at home and it's great. My outer screen uses ^Z as its escape key (I ^Z very few commands) and the inner ones use ^O. It works wonderfully, and I never have a problem remembering which screen has what because of the different escape keys. It's sort of like the finger memory that you develop if you use multiple workspaces (esp in a WM that supports tagging windows) and always keep the same things on the same workspaces.
- maxaf 14y ago^Z looks like a great escape sequence. Never thought of this one. ^O is my current favorite, and ^\ isn't far behind.
- spudlyo 14y agoI use job control pretty often, so ^Z is out for me. I use ^O as my screen escape key, which back in the way old days used to flush output, which was extremely handy at 300 baud.
- maxaf 14y agoMe, I tend to leak tmux sessions and windows all over the place. It's almost like job control but with a modern twist.
- bashinator 14y agoI like ^J myself. Left pinky, right index finger.