Not really sure what the “How Can We Stop it?” bit refers to. I guess it made sense at the time of writing…
TMUX is a terminal multiplexer: oh course it is! ¿Qué? A terminal multiplexer enables one to create a number of terminals that can be accessed and displayed on a single screen. Each session can also be detached and run in the background waiting to be reattached. The crux of the matter is that TMUX allows one to open many terminal windows up at the same time and display any way you wish. Open vim, create a vertical split and open lynx, create a horizontal split beneath and chuck in a basic free terminal. Need more panes? Running out of screen space? Create a new window and set up some more panes then simply switch between when the mood arises.
As with all things in unix world there’s a handy file one
can edit to configure TMUX. By default this file
doesn’t actually exist so you can either create it and then edit or grab
an example file to edit. Since we have no idea what the file should look
like let’s grab a copy
cp /usr/local/share/tmux/example_tmux.conf ~/.tmux.conf.
Mess around with colours and what not but pay attention to the important
things. TMUX is largely operated with keyboard
shortcuts that one simply has to learn in order to effectively use the
program. All shortcuts are proceeded with the ‘prefix’ that is by
default set to C-b (that means control + b). We
don’t like that shortcut as the keys are too far apart and the
combination isn’t natural enough for constant use. If you do actually
like it then by all means keep using it otherwise take a look at the
config file. The example config changes the ‘prefix’ to
C-a. I personally have set mine to C-Space but
bear in mind how you use TMUX and any potential
conflicts with other software. In any case have a read through the
example as it is well commented.
30^th December 2017 Update: This section is depreciated. The
most recent version of TMUX no longer needs
reattach to user namespace to get functioning copy &
paste. You can safely ignore all of the following nonsense.
Why do we need an entry for copy and paste? It’s a pain, at least on
OS X. In order to have functioning, clipboard-enabled,
c&p we need to do some stuff first. First of all, install this :
brew install reattach-to-user-namespace. This is a small
utility that works with TMUXs ‘copy-pipe’ feature
(introduced in version 1.8) and sends the sends the data through
‘pbcopy’. In order to make these two pieces of software harmonise one
must add the following to their config file :
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Setup 'v' to begin selection as in Vim
bind-key -t vi-copy v begin-selection
bind-key -t vi-copy y copy-pipe "reattach-to-user-namespace pbcopy"
# Update default binding of `Enter` to also use copy-pipe
unbind -t vi-copy Enter
bind-key -t vi-copy Enter copy-pipe "reattach-to-user-namespace pbc
opy"Rest assured folks, I nabbed the above script from a website in Lynx, in another TMUX pane using vim-styled Visual selection and the system clipboard. And it was good.
From here on out we will append commands with ‘prefix’ rather than
C-b as you’ve probably changed the default. We will also
just list shortcuts now as this is the meat and drink of
TMUX. Observe.
tmux new -s $NAMEtmux attach -t $NAMEtmux kill session -t $NAMEprefix dprefix C-ztmux switch -t $NAMEprefix sprefix $tmux list-sessions |
tmux ls:newprefix sprefix $prefix ( or
prefix )prefix Lprefix cprefix nprefix &prefix wprefix ,prefix nprefix pprefix rprefix xprefix zprefix "prefix %prefix C-oprefix oprefix [UDLR]prefix spaceprefix alt+[UDLR]prefix { or }prefix !prefix Spaceprefix q:setw synchronize-panesprefix ?prefix [tmux infotmux source-file ~/.tmux.confprefix :prefix tVery basic TMUX tutorial A TMUX Crash Course Learn X in Y Minutes : Scenic Programming Love, hate and TMUX Practical TMUX HyperPolyGlot Multiplexers TMUX copy paste on OS X a better future TMUX Cheatsheet