
Tmux, for fun and profit - phsr
http://reefpoints.dockyard.com/ruby/2012/04/10/tmux-for-fun-and-profit.html
======
afhof
I am going to go out on a limb and say this article has little to no content.
I am surprised that it has 69 points despite being very light on content.

More over, the comments here are mostly tangential to the article (except in
the sense that they involve the word tmux).

Am I totally wrong? Can everyone else see into this article where I can't?

~~~
ericb
He explains how he uses tmux for pair programming. Seems useful to me.

~~~
arnoooooo
He says he switched from screen to tmux, then describes very shortly a use
case in which tmux does not bring any benefit over screen (sharing a vim
session).

------
akkartik
I found this to be a far superior article:
<http://news.ycombinator.com/item?id=3824399>

~~~
shurane
It's rather amusing that your link has only seen 3 up votes. That's a real
shame.

------
pgambling
This post got me thinking about building a remote dev system using tmux
running on EC2 or some other cheap VPC host. I like the idea of pulling up a
fully configured dev system from anywhere. Mainly so I can pick up the same
session from home or work for hacking on my own projects, rather than keeping
two separate systems in sync.

Does anyone else do something like this?

~~~
ianbishop
I'm doing this now!

I've got a linode box running arch. I configured it with all my dev needs. I'm
currently in university and I spend a good amount of time at school, bouncing
between labs and then also working from home.

Right now the process is simply:

    
    
      ssh me@mydomain.com
      tmux attach
    

Up comes a familiar |- split console with vim running in a window, a terminal
at the root of whatever project I'm working on and the server output of that
project below it. If I have to leave suddenly, Ctrl+A+D and walk away. It'll
be there when you log in next time.

It also has huge advantages if you're working remotely with teams or just want
to launch stuff. I have nginx already configured and running. When I need to
launch a new project:

1) Go to the Linode DNS Manager and setup a new subdomain

2) Go to /srv/http and git clone my project

3) Edit my nginx.conf, reboot nginx and done.

Some stuff worth checking out:

* <https://github.com/thoughtbot/dotfiles>

* [http://www.thegeekstuff.com/2009/04/ctags-taglist-vi-vim-edi...](http://www.thegeekstuff.com/2009/04/ctags-taglist-vi-vim-editor-as-sourece-code-browser/)

Edit: formatting

~~~
pgambling
That's exactly what I want, a remove dev box for working on and serving up web
projects. I'm setting this up on an EC2 micro instance right now, slowly
getting a feel for the tmux key bindings. Thanks for those links, great stuff!

------
pyre
My comment from the blog post:

tmux and screen both have upsides and downsides for pair programming. Ones
that I know of:

1\. screen requires itself to be setuid root for session sharing. This is
security issue to say the least. The frustrating part of this is that screen
_explicitly checks_ that that uid == 0. This means that, even if you can iron
out all of the permissions issues between you and your partner without needing
root access, screen will only accept suid root as the solution.

2\. When you are screen sharing in tmux, the configuration used is the
configuration of the person hosting the session. This can suck if you have a
lot of non-standard bindings, because it forces the person you're pairing with
to know them too. screen allows you to both use your own configurations while
being connected to the same session.

~~~
aantix
Remote pair programming sucks. I don't know why there isn't a higher level
protocol that would send simple tab changes, text highlights, text deletion,
and other high level common tasks. This way the two connected programmer could
actually be using different editors but still experience the same editor
actions. And each user could maintain their own separate key bindings.

Who cares if I press cmd-t to open a file or my pair prefers to open a file
with cmd-shift-n? Just send me the action that a file was opened.

I wrote up my detailed thoughts on fixing remote pair programming here.

<https://gist.github.com/1999816>

~~~
pestaa
As with Google Documents where you can see other changes in real-time?

Yes and no. Would be really fun for five minutes and really irritating for the
rest of the time.

~~~
aantix
That is what pair programming is about. Collaborative changes in real-time.

~~~
adambyrtek
I would say that pair programming is primarily about close collaboration
between people, code is just an artifact of that.

------
CJefferson
I've used tmux and screen on occasion, but I can't get past the fact that they
don't fit well with GUI terminals. I love having "GUI" scroll-back, which I
can go through with mouse scroll-wheel, or just dragging the scroll bar up and
down.

~~~
wonginator1221
You could enable the mouse for mouse interaction with a supported terminal. In
my tmux config:

    
    
      set -g mode-mouse on
      setw -g mouse-select-window on
      setw -g mouse-select-pane on
    

This particular configuration will allow you to scroll, select text and focus
windows and panes with just a mouse click.

~~~
moe
Except you can't natively select text for copy/paste anymore.

When you click-drag you're now triggering a tmux selection, not the native
terminal-emulator highlight. This is a big problem because the emulated
variant is slow and behaves nothing like the real thing.

To my understanding this is also a problem that can't be solved without
further terminal emulator support. As it stands the remote application (tmux)
can either receive _all_ mouse-events or _none_ of them.

This means you have to choose between scroll-wheel support plus broken text-
selection - or no scroll-wheel support.

~~~
ajtaylor
I tried the mouse integration and turned it back off for the same reason as
you. Not having copy-paste at the terminal level is a non-starter as far as
I'm concerned. Learning the vim movement commands better eliminated most needs
for the mouse-pointing ability anyway.

~~~
desipenguin
Same here. But I found a decent workaround.

I have following in my .tmux.conf:

    
    
       set -g history-limit 1000
       # See https://wiki.archlinux.org/index.php/Tmux#Scrolling_issues
       set -g terminal-overrides 'xterm*:smcup@:rmcup@'
    

Now I can scroll using "scroll bar" which is acceptable for me. Plus I also
get native text-selection.

------
SkyMarshal
This is cool and something I didn't know about tmux:

 _"The one disadvantage of everyone at DockYard working remotely is that you
can't just turn around and ask someone to come to your desk to pair up. Tmux
allows multiple users to connect to a specific session. With a bit of dynamic
DNS magic, port forwarding, and ssh tunneling, multiple people can connect to
the same tmux session, work in the same vim window, and see the same
development server."_

...

 _"With a tmux, ssh port forwarding, and Google+ Hangout, you can create a
useful pair programming environment with your remote coworkers. We find this
setup very effective and use it often to work together and tackle an issue."_

~~~
derwiki
I also use tmux to conduct remote code-pairing interviews -- very similar to
regular pairing except that I've never worked with the candidate before.

------
mattwdelong
Just out of curiosity and without creating yet another HN Poll; Who prefers
Tmux over Screen and why?

~~~
bcardarella
My preference for tmux is solely based around Brian's book. It was the first
time that I actually "got" terminal multiplexing.

~~~
jasonlotito
Going to once again pimp this book and it's delectable goodness. It's a
_wonderful_ book, well written, clear, concise, and in just a few pages, gives
you a lot to work with. Highly recommended.

<http://pragprog.com/book/bhtmux/tmux>

------
pestaa
Can someone please explain why dynamic DNS, port forwarding and SSH tunneling
involved when attaching to the same session?

I just fired up two instances of Putty and see my keystrokes replicated within
a second.

~~~
dfc
Are you in two separate locations connected to two different networks at the
same time? The author is talking about telecommuting. Sure dynamic dns is not
needed but timsbox.dyndomain.com is a lot easier to work with than whatever IP
he has today.

~~~
pestaa
Ah I see now, thanks. You don't need any of this though if you have a
dedicated development/staging server, which is I prefer.

------
drivebyacct2
Does Mosh (posted yesterday) support multiple connections? I know it can
suspend resume like screen/tmux. Seems like it would be preferable if it does.

------
bulibuta
``Mouse free environment'' is a retarded concept.

And that book doesn't understand anything about tmux and why it came about.

~~~
pestaa
Sounds implied you do understand it better, so don't keep it to yourself.

Also, mouse-free environment is not just a concept, and most certainly not
retarded. Care to elaborate why you think that?

