[ale] Tmux, where have you been alll my life?

Dylan Northrup ale at doc-x.net
Wed Sep 21 19:14:45 EDT 2016


Replies inline...

On Wed, Sep 21, 2016 at 5:54 PM, Chris Fowler <cfowler at outpostsentinel.com>
wrote:

>
>
> ------------------------------
>
> *From: *"Dylan Northrup" <ale at doc-x.net>
> *To: *"Atlanta Linux Enthusiasts" <ale at ale.org>
> *Sent: *Wednesday, September 14, 2016 10:42:12 AM
> *Subject: *Re: [ale] Tmux, where have you been alll my life?
>
>
> Even if connections don't fail, I am not always working from the same
> host.  James gets it exactly right for my use case.  With tmux, I can
> encapsulate context around a specific task by having multiple windows (or
> panes in those windows) for a task.  Tmux also lets me attach to the same
> session from multiple bash shells so I can move things around based on what
> I need to focus on with a keystroke instead of having to move a mouse or
> move windows.
>
>
> Can you explain a bit more.  I know you can use tmux to connect to a
> socket.  I could SSH into my desktop from anywhere and connect to its
> socket.
>
> I install devices in the field and redirect output to different VTs.  I
> could just start a tmux session as root, spawn programs to get and display
> the output instead? Is it possible to latch onto /dev/console?
>

Let me make sure our nomenclature is correct.  When I say "session" I mean
"one instance of tmux, typically running on a bastion/workstation computer,
where I will spawn multiple windows/panes in that session to either work
locally or ssh out to remote systems".  Once I have an instance of tmux
running, I can run 'tmux attach-session' in another terminal window to get
access to that very same "session" (and all of the windows/panes in that
session).  So, for instance, I can start tmux, create 4 panes in the first
window (that you get for free), ssh to four different boxes in each of
those panes, then create a new window, create four new panes, ssh to the
same four boxes and begin tailing log files.  Then (and here's the magic I
was talking about), I can start up a new terminal window, attach to my tmux
session, make sure I'm on the first window, and do some process restarts on
those four machines while monitoring the log files in the previous terminal
window.  Oh, and I can synchronize the keystrokes in each of the panes, so
I did "cd /var/log/foo; tail -F foo.log" one time, not typing it into four
different windows.


> My work setup has four monitors that regularly have ssh sessions up on
> them.  With tmux, I can move the current activity to the "primary" monitor
> and have others for referencing log files, man pages, running compiles,
> etc. that are related to what I'm doing on the primary window.   Then, when
> I need to reconnect from home, I can do the same thing (albeit with fewer
> monitors) and have the current activity on one monitor and reference
> information on the other.  And I don't need to reconnect to various hosts,
> re-run session commands, etc.
>
> But, for me, the killer app for tmux is being able to do something akin to
> csshX inside a terminal without having to install anything on the box I'm
> sitting at other than an ssh client.  Being able to run 'mwin
> {web,app,db}host-{dev,ref,prod}{1,2}' and get an ssh session on 14
> systems with multiplexed input to be able to work on all of them at the
> same time to be able to tweak a config, trigger chef/puppet, deploy a
> security patch, etc. is amazing.
>
>
> If you are on a system that has ssh client you'll just ssh to a remote
> system and execute tmux?
>

No, I'll run tmux on the system with ssh, then ssh from the shells inside
tmux session out to the remote systems.

As far as "what is the tmux command to do X?" "C-b ?" is your friend (or,
> for folks like me who remap C-b to C-a, "C-a ?").  If anyone is interested
> in my tmux configurations (and helper scripts like 'mwin' listed above), I
> have them in https://github.com/dylannorthrup/dotfiles/ .  My .tmux.conf
> is in the top level, helper scripts are under ~/.tmux and 'mwin' is under
> ~/bin.  Happy to answer any questions folks might have.
>
>
> I'm curious about your setup I'll check your .dotfiles.
>

If you (or anyone else) has any questions about this, I'm happy to answer
them if I can.   And let me know if anything I've said here needs more
clarification.

-- 
Dylan Northrup
"Adversity is just change we haven't adapted ourselves to yet."
  - Aimee Mullins
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.ale.org/pipermail/ale/attachments/20160921/1f70834d/attachment.html>


More information about the Ale mailing list