Currently a byobu user, it seems fine so far. Wondering what others offer more than that.
Currently a byobu user, it seems fine so far. Wondering what others offer more than that.
I'll use screen when I need to run a long-running task and can't keep my terminal session open.
I use tmux with a script so that I can ssh into multiple nodes and broadcast the same commands to them all at the same time. Great for interactive deployments that I haven't been able to automate away with CFEngine just yet.
I sometimes need to do this with multiple VMs. I'm really, really not in favor of bash scripting, but I've found the following to suffice, without the tmux dependency:
for host in box1 box2 box3; do ssh $host 'command; command; command'; done
(This presumes you've set up ssh-agent or are using passphraseless keys and suitable stanzas in ~/.ssh/config; adjust to taste if not.)I'd never heard of using tmux in this fashion before. Is it that the task sufficiently resembles a nail, or does tmux provide some unique benefit here?
My shell script takes in a list of tuples (hostname plus a special id that I need to paste for my tasks that's unique to each host), splits off a window pane for each hostname(tmux split-window -h), ssh's into each host in it's own pane, and turns on synchronization.
I did a little trick to setup pastebuffers to hold that special id from the tuple i passed in. And setup keybindings so that I can press a key combination to paste in that ID whenever I need it to each respective pane.
If I ever need to temporarily remove a pane or several panes from the syncronized session but keep the others synced, I just change focus to the pane I want to unsync and put it into copy mode with "Ctrl-b [". Can take the pane back out of copy mode by hitting "q".
So far it's made me much more productive when I have to run a bunch of identical commands on a cluster of nodes for which we have no defined process (i.e. I'm figuring it out as I go).
I'll need to sanitize the script, but I'll try to put up a github gist of the script later on.
> I'll need to sanitize the script, but I'll try to put up a github gist of the script later on.
If you wouldn't mind, I'd be hugely grateful as I often find myself having to do similar tasks as what you describe (and even wanted to set up a script to auto start sessions in different panes like you do but wasn't aware that was possible).
While I do use tmux quite heavily (to the point where I found myself needing to rebind a lot of the keys to be more vi like or more convenient to manage one handed), I reckon I still only use about 10% of it's functionality. So it would be good to see other solutions based around tmux.
bind S setw synchronize-panes
Without the on/off option, it acts as a toggle, making it a keystroke away.https://twitter.com/j_melis/status/179173797285478400
Seems like a neat trick
$ ssh hostname
$ screen
# some time later, you get disconnected...
$ ssh hostname
$ screen -x
# back to where you were before getting disconnected.Seriously, the amount of commands linux has that most people don't know about is staggering. This link[1] was on HN just the other day.
[1] http://www.danielmiessler.com/blog/collection-of-less-common...
I'm using screen right now to scp 4.5Gb from home to my Docker host. I'll close the terminal at some point and check progress tomorrow.
I guess you could do that in Docker.. but why would you?
I use it all the time on my RasPi at work, running a mutt instance. I can hop in from any machine and have my 'native' email client accessible.
It's just an example. Tux lets you automate interactive shells.