

A Tmux Crash Course (2011) - shawndumas
http://robots.thoughtbot.com/post/2641409235/a-tmux-crash-course/#

======
oostevo
If you're willing to spend $14 for a more detailed tutorial, I'd strongly
recommend _ tmux: Productive Mouse-Free Development_ from The Pragmatic
Bookshelf.

It goes through common use cases, common customizations, and pair programming.

[http://pragprog.com/book/bhtmux/tmux](http://pragprog.com/book/bhtmux/tmux)

~~~
raldu
I do not get the idea of buying a "book" to learn a *nix utility that explains
itself in a single man page when all you need to learn is just a few keyboard
shortcuts.

Obsessively focusing on the tool does not magically improve productivity.

~~~
danneu
A manpage doesn't help you arrive at a workflow or show the forest for the
trees or give field advice from someone that uses the tool or reveal ways to
integrate the tool with other programs.

~~~
easytiger
No but 45 minutes using it will. Not saying this book is no good, but 90% of
tech books on softer subjects like this aren't worth the paper they are
printed on. They hark back to the day when I first walked into Sun and saw a
dozen volumes xn versions for the xmotif and xlib reference manuals.

------
msimpson
Terminal multiplexers are great if you're stuck in SSH, working without a
window manager at all, or have a real need to share a set of terminals with
multiple people at once.

But if you're hacking together a desktop environment with tiled terminals,
status bars, keyboard shortcuts, dynamic or static layouts, and the ability
conceal layouts on different workspaces (which is what most people's intent is
when using detachment), then just get a tiling window manager already.

You're reinventing the wheel.

~~~
enduser
I agree wholeheartedly. Take what you love about tmux and extend it to include
all applications. In addition to terminals (rxvt-unicode-256color) I run
Firefox with Pentadactyl. With wmii (my tiling window manager of choice) I
have keyboard-free navigation between vim and Firefox.

I don't buy into the remote development over SSH method. Servers with as much
horsepower as my ThinkPad with an i7, SSD, and loads of RAM cost a lot, and I
can't stand latency on my terminal when I'm working hard.

------
bpizzi
Tmux is definitely a nice piece of software.

For me it has been the last brick in date in my terminal-based IDE, which is
made of zsh/vim/ssh/tmux.

Everything is running on a remote dedicated server, and I can access my dev
environment wherever I can find an internet connection and launch a ssh tunnel
(which is, in my case, almost everywhere I would find myself wanting to work).
In that case, tmux's sessions are god sent.

I would have say the same for screen before, but with Tmux you can have this
sort of niceties :
[https://github.com/Lokaltog/powerline](https://github.com/Lokaltog/powerline).
Basically, it's a statusline with bells and whistle.

------
sidmitra
I use Terminator
([http://www.tenshu.net/p/terminator.html](http://www.tenshu.net/p/terminator.html))
primarily on local machines instead of screen/tmux(or byobu). I get the added
benefit of scrolling.

I tend to copy paste a lot from log tails etc into my my text editor for quick
searches or other things. The infinite scroll feature(with a scroll bar) helps
me out a lot. In tmux/screen i still haven't figured out a good workflow to
copy a few screenful of content.

On servers i tend to use Byobu bindings which now use tmux(used Gnu screen
some time ago). It has good defaults and some help for newbies to get used to.

~~~
bluehavana
Have you tried tmux's mouse modes?

You can use the mouse wheel to scroll and highlight to copy. I think you are
specifically trying to say the mouse highlight won't go past one window
though, right?

You can also resize panels and select widows.

~~~
agumonkey
I knew I saw a way to interact with it through the mouse. Thank you for
reminding me. `tmux` is really a neatly little program, everything is there,
simple and efficient.

ps:

    
    
        man tmux | grep "mouse-" # shows the mouse related options
        C-b : "set mouse-<option> on"
    

pps: turning on mouse windows/panels interactions disable text selection, do
you know a way to have both ? (beside switching beside custom defined modes on
your .conf)

~~~
FreeFull
You can always do text selection in a terminal by holding shift while
selecting the text, no matter if the program running in the terminal supports
mouse or not. I think on some terminals it's alt instead of shift.

------
bkanber
This is the exact workflow we use at my company as well, and we've all grown
to love it.

I got a new laptop today, and because we do all our dev on a remote server via
ssh, tmux, and vim, it only took a few minutes to get my new machine set up
for development. All I had to do was download iTerm and copy over my private
key and config file! So easy.

I've seen this referred to as "Unix as an IDE". Big fan.

------
fphilipe
Looks like the author only uses one session he calles "work". What I really
like about sessions is that it allows for isolated contexts which are easy to
switch (prefix-s get prints you a nice list [1]).

Right now I have seven sessions open [1]. Three are work projects (they
usually have windows for vim, db console, etc.), two are university courses
(vim, matlab), in one session I'm learning some Haskell, and in the last one
I'm working on an open source ruby gem. If I had all these windows in one
session only, I'd constantly be switching to the wrong windows.

[1] [http://cl.ly/Qgaz](http://cl.ly/Qgaz)

~~~
elithrar
> What I really like about sessions is that it allows for isolated contexts
> which are easy to switch (prefix-s get prints you a nice list [1]).

I always end up doing the same as the author (out of bad habit), when I should
really be using windows more often (to split out dev work, irc, uni work,
etc). It's good advice and stops the too-many-windows problem.

Also: what theme are you using in that screenshot?

~~~
fphilipe
The colors are base16 [1]. You can find the tmux conf for the tab bar at [2].

[1]
[https://github.com/chriskempson/base16](https://github.com/chriskempson/base16)

[2]
[https://github.com/fphilipe/dotfiles/blob/master/tmux.conf#L...](https://github.com/fphilipe/dotfiles/blob/master/tmux.conf#L69-L88)

------
rogerbinns
I highly recommend byobu. It acts as a front end to tmux (or screen) and
provides some nice functionality like a status bar and various default
keybindings that are consistent.

~~~
nicholassmith
I use byobu pretty heavily and love it. Even if you don't venture too far into
the scripts etc it's incredibly handy to fire up on a server and have multiple
panes whilst working.

------
glesica
I've seen this before, it was immensely helpful for moving from a multi-window
workflow to a single window with tmux. The tmux docs themselves are a bit
obtuse and don't do a very good job explaining the various concepts tmux uses.

------
FrankBro
I am curious to know what are the major differences between tmux and a tiling
window manager? I've used awesome Wm for a while, now on i3wm.

~~~
bphogan
So I wrote a book on tmux and use it every day, but I use i3 on my Linux box.

The main difference? tmux is a terminal multiplexer. So it's not going to
handle the web browser stuff at all. Other than that, it's like Screen.

A lot of devs spend a lot of time in the Terminal, running scripts, background
servers, etc. With tmux (like Screen) you can have them running and detach,
and come back later.

Even with i3 I still find lots of room for tmux in my workflow when I'm in
that environment.

tmux is also a hell of a tool for pair programming, and for managing remote
servers.

But yea, if you're happy with i3, and you're using that to do Terminal splits,
that's probably pretty great as is. tmux will remember the current working dir
when you open new splits, and you can script it to launch your project
workspace, but that's kind of just icing.

------
stormbrew
Boy, a tiling WM might just blow his mind.

~~~
vidarh
Maybe, but personally I find that terminal windows are the only thing I tend
to want to split the screen for. Almost everything else I prefer to run in
full screen. If I had a 50" screen or something, I might feel differently, but
with two smaller screens the two separate screens offer enough tiling for non-
terminal windows.

I was planning on installing a tiling WM when I got my last laptop (I used to
use Ion, so I'm used to the concept and wanted to give it another go), but
frankly as much hate as Unity gets, once I had Ubuntu installed I realised
that with some keybinding tweaks it was sufficient.

~~~
stormbrew
To be fair, in your the OP's case at least your editors are included in the
terminal category.

For me I find that even on 25" screens full screen is usually too much. I
prefer to split at least once for every screen now. It was different when
monitors were 4:3, though. I made things full screen all the time and was
happy with it then.

I'm not 100% happy with tiling WMs though, tbh. I find their focus on being
completely mouseless and minimalist integration-wise kind of limiting.

------
wrs
Since this article was written in 2001, iTerm2 has implemented support for the
tmux protocol, so windows, panes, scrolling etc. happen at the GUI level
instead of the terminal level. Kind of the MacVim of tmux.

[https://code.google.com/p/iterm2/wiki/TmuxIntegration](https://code.google.com/p/iterm2/wiki/TmuxIntegration)

------
benradler
Tmuxinator is an awesome gem that extends tmux to allow you to set up specific
sessions that can be booted up. You can customize panes, pick specific apps to
run in each, and there's tons of customization that can be done:
[https://github.com/aziz/tmuxinator](https://github.com/aziz/tmuxinator)

------
Cieplak
How to copy to system clipboard from tmux output after mouse selection?

[http://stackoverflow.com/questions/12287432/how-to-copy-
to-s...](http://stackoverflow.com/questions/12287432/how-to-copy-to-system-
clipboard-from-tmux-output-after-mouse-selection)

~~~
bkanber
If you have mouse integration off, selecting text in the terminal copies it to
the system clipboard. As simple as click+drag to select.

~~~
mcx
How about copying text isolated in a pane to the system clipboard? For example
if I have a split vertical pane, it will copy text from both panes.

~~~
mmcnickle
Newer versions of tmux have an expand pane command mapped to Leader-z. It will
grow the pane to full size, do your xopying then leader-z to toggle back to
your normal split view.

------
res0nat0r
I've been seeing tmux posts a lot the last couple of years, but I can't pull
myself away from screen which I've been using for what almost a decade now?

It has a higher chance of being installed by default on a remote system I
don't have root on, and works just fine for everything I need so I haven't had
a reason to switch yet.

~~~
bluehavana
If you happened to have mastered screen, all the more power to you. I know
there can be a lot of power in screens rc and scripting.

Tmux was easier for me to understand and the default packages are much easier
than patched screen.

Also, there seems to be a steady stream of features released for tmux. I've
heard screen can be quite stagnant.

------
leetrout
I have learned to be careful about any long running or interactive processes
that end up out-of-sight-out-of-mind. I accidentally left a db connection open
in one of my tmux windows and our staging db didn't refresh for 2 days haha.
(And I immediately started debugging in the wrong places, of course.)

------
cturner
I like being able to shift+pageup in consoles to see history, but haven't got
a good replacement for this in tmux. (Including when you switch to a new
window and want to see something.) Usually I go into copy mode and scroll up.
This works. But maybe there's a better way. Anyone know?

~~~
r080
I found this [http://superuser.com/questions/209437/how-do-i-scroll-in-
tmu...](http://superuser.com/questions/209437/how-do-i-scroll-in-tmux) (take a
look at second answer). But it has its drawbacks like not respecting panes
etc... After some time I had this in my config I found myself using copy mode
anyway.

------
icementhols
I found the info at the following to be a bit more in-depth and its split into
a number of posts.

[http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-
multip...](http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/)

------
aidos
I know everyone remaps their prefix to ctrl-a - how do you then jump to the
start of a line?

Edit: Thanks for the solutions. Will have a play. Like the sound of using
ctrl-\

~~~
fphilipe
You map a to send the prefix: bind-key a send-prefix

Now when you type <prefix-a> ctrl-a gets sent.

~~~
jh3
A while ago I changed my prefix to ctrl-q because of ctrl-a interfering with
me being able to move to the beginning of a line. Not sure if I would go back
to ctrl-a now, but this is nice to know.

------
akshaym
Totally irrelevant, but this is from 2011.

